-
Notifications
You must be signed in to change notification settings - Fork 95
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
BUG Do not override grid state with search parameters #1103
BUG Do not override grid state with search parameters #1103
Conversation
I think that we should get better about embedding grid state changes into the URL using the history js api Benefits
The main worry I would have is multiple grid fields on a single form, to check that the grid state is linked to the right grid. I raise this here because I'm not sure if such work would conflict with this PR? |
An alternative approach could be to make sure that any grid state change are immediately reflected in the URL. Even if we go with this kind of approach, I don't think we should directly read the GET parameters from the URL. We should have some sort of abstraction that can tell us what the current grid state is. When you first access the a given URL, that abstraction would be hydrated with the grid state provided in the URL. Then has the grid sate changes, the abstraction would update the URL using the History JS API. |
Sorry that's what I meant by "embedding grid state changes into the URL using the history js api" I believe that with that in place, the server-side render of GridField should be able to do what's needed without special post-render treatment being needed in the JavaScript. At the very least, I would start by setting that theory using some handcrafted URLs. I agree that the actual manipulation of the gridstate on the client side should be captured in a shared helper of some kind. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't get this working.
When going back to the previous URL from the detail view, nothing is filtered and the query params are still empty.
When clicking the back button, the query params are present, but it's not filtering anything.
That's not exactly what this thing was trying to fix (although yes, we should fix that). The bug I was trying to fix is this.
Expected results: The next result returns matches the second sorting order. |
e5c73d8
to
7594ef2
Compare
There's a bit of logic hat overrides the girdstate when you click the detail button with your search parameter, which might not reflect your current gridstate.
This video illustrate the original problem and the end results when the patch is applied.
https://youtu.be/Jw-zdpkXe-Q
Parent issue