-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Replace rowGetter and rowsCount with rows[] #1869
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
Conversation
I don't think this is an issue as we can use endless scrolling to call API to pull the new data. #1854 If it's for memory consideration for huge data set, maybe the dev should just implement the pagination.
If we pass the row idx / column idx only, then probably we have to discard the
Looks like Proxy is not IE 11 friendly. However, just out of curiosity, could you extend a little bit like how you would use it? |
Something like that: const rowsProxy = new Proxy({}, {
get(obj, prop) {
if (prop === 'length') return rowsCount;
return rowGetter(Number(prop));
}
});
return <DataGrid rows={rowsProxy} />; |
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.
LGTM. I think for lazy loading we can now just use the onScroll
prop. Let's wait for @qili26 to review this PR as well
Nm, just realized he has already approved it |
I think
rowGetter
is an antipattern: ifrowGetter
never changes, then it will hide row updates, and might prevent rerenders in memoized components/useMemo
.The downside is that users will now need to load all the rows at once.
We're also updating rdg to leave value access to the formatter/editor implementations, so not all data needs to be computed upfront.
I wonder if we even need row objects at all! Formatters and editors could just load the row data with only the row index. But then how do we trigger cells rerendering?
Alternatively, users could use a Proxy on
rows
or as row objects. 🤔WDYT?