-
-
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
Restore List Scroll Position on Edit and Create Views side effects #9774
Conversation
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.
Can you explain how to test this feature?
Now I'm thinking: what if there is more than one |
Should we add a |
Other suggestion: scroll restoration should be dealt with earlier, in the CoreAdminRoutes, instead of in the List component. |
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.
Nearly there!
* import { RestoreScrollPosition } from 'ra-core'; | ||
* | ||
* const MyCustomPage = () => { | ||
* <RestoreScrollPosition key="my-list> |
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.
syntax error, missing quote
Co-authored-by: Francois Zaninotto <[email protected]>
Problem
When users have a long list page, navigate from it to an edit or create page, the
onSuccess
redirection of those pages redirect them to the list but loose their previous scroll position. This is bad UX.Solution
useRestoreScrollPosition
hook that tracks the page scroll position and restore it when the component mounts.Resource
component for list only_scrollToTop
state when redirecting to a list viewHow to test