Comments (5)
Good catch! Would you mind opening a PR to fix it?
from react-admin.
Actually, we already had a few similar issues about this and the answer is not so simple: see #8536 and #7401
from react-admin.
Hi there, thx for the quick reply! I've thought for a while about the issue at hand and read through the linked related issues and wanted to add my two cents to it.
First of all let me restate the issue to know if I undertood it well enough:
When implementing row selection in lists, resource-bound global selection state was chosen for, among others, one main goal: keep selection accross navigations (mainly list view <-> edit view back and forth user experience) and be able to delete records from other views (mainly the edit view) and being able to deselect (if selected) that record so when the user goes back to the list all is consistent.
Since then, a custom storeKey
prop has been added to the list controller to allow different lists using the same resource to be, for example, filtered independently from one another.
This independence cannot be applied to the selection state because it would break the stated main goal, since when deleting a record from its edit view there could be arbitrary keys in the store that would have to be updated, which is not possible or very hard to manage.
Now with the problem stated, I think that the custom storeKey
funcionality is not 100% complete, let me explain:
I would argue that the meaning of storeKey={false}
is "For this list, I don't want any store interaction", not for list params and also not for selected rows, no interaction at all. For this reason, and only if storeKey
is false
, the list should keep the selected rows in local state, and use the resource-derived storeKey
otherwise. That would mean that if I navigate away and come back, the list won't have any selected rows, but I chose that consciously.
By using "the resource-derived storeKey otherwise", we avoid breaking react-admin's desired interactions with the store for selection related stuff. For normally managed lists, current behaviour is kept in all cases. For storeKey={false}
lists, any navigation away from the page will loose (unselect) its selection state, so deletions from another page don't have to worry about ghost selected rows for that list.
I've made a quick PR so we have some code to look at, and also to show that the changes seem to be limited to a couple files.
from react-admin.
@nbalaguer that seems like a sensible approach, thanks for taking the time to explain it.
from react-admin.
Fixed by #9742
from react-admin.
Related Issues (20)
- Add ability to customize query string format for lists HOT 5
- i want to show the received gmail in react js app
- AutoComplete choice listing issue when using useChoicesContext HOT 1
- react admin error with Menu.Item missing properties HOT 6
- useEditContext returns null for both values HOT 5
- Infinite loop occurs in page rendering when perPage is set to a negative number in List Component HOT 2
- Codemods are not included in ra-core v5
- Duplicate entries in documentation search HOT 2
- `<PasswordInput/>` or `<TextInput/>` has corrupted `validate` prop, if field is handled with `disabled` prop HOT 4
- Auth provider login Promise rejection with "message" doesn't trigger notification message HOT 1
- When we use useRedirect hook to go back to a List Component, the pagination is reseted to page 1
- <AutocompleteInput> and <AutocompleteInputArray> refetch choises passed from graphql HOT 1
- Fields inside the ArrayInput aren't set as dirty when built HOT 1
- When a form contains ArrayInput with large entries. It takes more than a minute for a form to be submitted. HOT 2
- Bug in Translation in post edit page showing (post "some text here") HOT 1
- Dark mode become default upgrading react-admin package HOT 1
- AutocompleteInput with ReferenceInput calling getList() two times after select on sugestion list HOT 1
- Clearing filters using setFilter({}) does not clear FilterLiveSearch text input
- [Translation] "Need help with this error?" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-admin.