-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
[WIP] Use normal store instead of React state with disabled location sync #8530
Conversation
This change is to continue using the normal React Admin store (local storage by default) when `disableSyncWithLocation` is used. Skips the `navigate` call and directly calls `setParam`
Thank you for your contribution. Indeed, your code introduces a breaking change. We cannot afford to make breaking changes for react-admin v4 (it would not respect semantic versioning). You need to find a way to make your feature backwards compatible, e.g. by introducing new props.
If there are no way to make your feature backwards compatible, then it should be kept for react-admin v5 (which has no dedicated branch yet). Lastly, I don't fully agree with you on that part:
Disabling the persistence for one List is not the same as disabling the persistence for all settings that are stored in the Store. |
I definitely see your perspective here and agreed on breaking change with that context. I will think about this and see if I can come up with a clean way to enable this in v4. I am curious, is the intention of I started using React Admin in v4, so I don't have the history on it, but my understanding from commit history is this:
Would it make sense for v4 to add something like |
@btbenedi You may be correct about the history of this design decision, honestly I don't know. I agree it would be nice to have the ability to disable the syncing with location, without disabling the parameters persistence in the Store. But it needs to be backwards compatible and we want to avoid adding too much complexity. Here's what I suggest:
What do you think? Do you think you could try to implement this? |
@slax57 I think I can manage that, and that is a solid idea, better than adding yet another prop I'll take a shot at it, I tried unsuccessfully last week to get the repo running locally, but this change is small enough I can probably get away with just using the PR builds |
@btbenedi thank you for your answer, and for giving it a shot 🙂 Some important additional info though: as stated in the contribution guidelines we will ask for tests and stories to prove the new feature is working (and make sure it stays that way in the future). So relying solely on existing tests won't be enough, you'll have to write new ones. Also, since this will be a new feature, your PR should target the Thanks a lot! |
…n sync" This reverts commit a5fd4cc.
@slax57 started looking at this, Thoughts? |
@btbenedi If I'm not mistaken, you can safely change this, because the |
@slax57 ahh, that makes sense, i'll get that set, and then start in on the tests/docs side of this PR |
only sets default `storeKey` when `disableSyncWithLocation` is `true` this enables the new behavior where store can be used when a `storeKey` is provided and when `disableSyncWithLocation === true`
@slax57 default value updated in code, and original PR description updated to reflect this change/behavior Will hopefully get to tests/documentation next week, still having issues with local environment, I think it's mainly due to node/npm versions, but haven't dug too much deeper. |
@btbenedi Thanks. Our team is a bit busy ATM, so don't panic if we don't review your PR right away. But it is in our to-do list and we'll do our best to be helpful in the meantime 🙂 Regarding the versions, if that can help, here are mine:
(btw I recommend using yarn for this project since it is the tool we use internally) |
Please update your PR with tests and documentation, and fix the linter warnings. |
as mentioned in the enhancement, real work has gotten in the way of me getting to fixing the known issues with tests/docs/linter If someone else wants to fork this and complete it, they are more than welcome to, but at this time, I cannot guarantee I will be able to complete this work myself. Feel free to close this PR if applicable. |
Thanks for the update. I'll close this PR as it's good for our morale to have a low number of open PRs ;) Feel free to reopen it when you have time to work on it. |
This change is to continue using the normal React Admin store (local storage by default) when
disableSyncWithLocation
is used, this enables filters, sort, and pagination to be persisted across navigation and component mount/unmount.In order for this behavior to work, the
storeKey
default value is left blank whendisableSyncWithLocation
istrue
.storeKey
is then checked (if blank) inchangeParams
, if blank, old behavior remains, useslocalParams
that do not persist, ifstoreKey
is set, then it uses store as normal.[WIP] [TODO] Documentation and tests updated to reflect this additional behavior
I feel this meets the design choice that filter values are persisted in application state as stated at the bottom of this section even if you need to not sync those values with the location due to have multiple
List
components on one page.Implements #9100