Skip to content
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

[DataGrid] Always refetch lazy-loading rows #16827

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MBilalShafi
Copy link
Member

@MBilalShafi MBilalShafi commented Mar 5, 2025

Related to #16719 (comment)
Pre-requisite for #16045, should ensure proper data integrity after an edit operation has been done in a lazy-loaded Data Grid.

Update

Previously, lazy-loaded data was never re-fetched, even in cases where:

  • The data was not cached.
  • The cache had expired.

Now, lazy loading attempts to fetch fresh data when the viewport is scrolled. If the data is already cached and valid, it's retrieved from the almost instant cache. However, if the data is missing or the cache has expired, the fresh data will be retrieved.

Todos

  • Add skeleton rows for off-viewport rows

Follow-up

  • Add dynamic data demo

@MBilalShafi MBilalShafi added component: data grid This is the name of the generic UI component, not the React module! feature: Server integration Better integration with backends, e.g. data source labels Mar 5, 2025
@mui-bot
Copy link

mui-bot commented Mar 5, 2025

Deploy preview: https://deploy-preview-16827--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against 6b3d7f3

@MBilalShafi MBilalShafi changed the title [DataGrid] Exploration: always refetch lazy-loading rows [DataGrid] Always refetch lazy-loading rows Mar 21, 2025
@MBilalShafi MBilalShafi force-pushed the lazy-loading-cache-update branch from 27e73db to f96e707 Compare March 23, 2025 00:51
@MBilalShafi MBilalShafi marked this pull request as ready for review March 24, 2025 20:32
@MBilalShafi MBilalShafi requested a review from arminmeh March 24, 2025 20:32
@cherniavskii cherniavskii self-requested a review March 25, 2025 13:49
@MBilalShafi MBilalShafi added the bug 🐛 Something doesn't work label Mar 25, 2025
@cherniavskii cherniavskii added this to the 8.0.0 milestone Mar 25, 2025
Copy link

Thanks for adding a type label to the PR! 👍

@arminmeh
Copy link
Contributor

https://deploy-preview-16827--material-ui-x.netlify.app/x/react-data-grid/server-side-data/lazy-loading/#updating-the-loading-mode

If you load additional pages and start switching row count demo will have a runtime error
(if you can't reproduce I can make a video)

*/
if (
Copy link
Contributor

@arminmeh arminmeh Mar 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can see skeleton rows on fast scroll which degrades UX.

Is it possible to keep the rows and fetch new data to refresh them?
loading state can be delayed a bit so that it shows up if you are actually waiting for the request to be resolved?

This will open up more cases for duplicate row id, but we can always check for that before applying update

Compare experience after loading all rows and scrolling fast
https://next.mui.com/x/react-data-grid/server-side-data/lazy-loading/#infinite-loading
https://deploy-preview-16827--material-ui-x.netlify.app/x/react-data-grid/server-side-data/lazy-loading/#infinite-loading

Also, I think that https://next.mui.com/x/react-data-grid/server-side-data/lazy-loading/#request-throttling needs to be skipped for already loaded rows, so that cache can be loaded faster

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! feature: Server integration Better integration with backends, e.g. data source
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants