-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
feat: use storeKey
in useRecordSelection
#10953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
feat: use storeKey
in useRecordSelection
#10953
Conversation
This is just a draft to make sure the solution is applicable for the framework. Btw, is there any chance to get this feature in minor release? |
can you explain why you need to introduce the notion of namespace, which seems to overlap with the storeKey feature? |
It's maybe more like storeKey, i just named it like this... Do you suggest to pass List's storeKey to useRecordSelection instead of adding separate & independent key for selection state? |
Exactly |
@fzaninotto ok, will do. |
Why will it be a breaking change? You only need to make the |
Any existing usage of List with non-empty |
So you're right, it's a breaking change, but one that we're willing to accept given =i see no use case for two lists with different store keys that would require an identical selection. You can continue on |
Ok. What about storing selection state in 2 separate keys ( @fzaninotto , can you please have a look at the question above? |
storeKey
in useRecordSelection
Problem
It's not possible to create distinct List views that use separate record selection states.
Previous discussion was started in PR: #10951
Solution
Store selected IDs under in a
Record<string, Identifier[]>
structure inuseRecordSelection
. List component passes thestoreKey
touseRecordSelection
. If storeKey is non-empty, then it's used as a key in the selection object. Delete controllers pass the flag to unselect deleted records from all storedKeys.How To Test
Describe the steps required to test the changes
Additional Checks
master
for a bugfix or a documentation fix, ornext
for a feature