-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[DataGridPro] Server-side tree data support #12317
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
packages/x-data-grid-pro/src/components/GridServerSideTreeDataGroupingCell.tsx
Show resolved
Hide resolved
packages/x-data-grid-pro/src/components/GridServerSideTreeDataGroupingCell.tsx
Outdated
Show resolved
Hide resolved
packages/x-data-grid-pro/src/components/GridServerSideTreeDataGroupingCell.tsx
Outdated
Show resolved
Hide resolved
packages/x-data-grid-pro/src/hooks/features/serverSideData/useGridDataSource.ts
Outdated
Show resolved
Hide resolved
logger.debug(`Updating all rows, new length ${props.rows.length}`); | ||
logger.debug(`Updating all rows, new length ${props.rows?.length}`); |
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.
Sidenote but these logger calls have the disadvantage that we need to create a new string in memory every time it runs, even if it doesn't log anything. If it's in a hot path, it could affect performance. A better option would be printf style calls that don't allocate new strings in the arguments, e.g. printf('new length: %i', props.rows.length)
.
packages/x-data-grid-pro/src/hooks/features/serverSideData/serverSideInterfaces.ts
Outdated
Show resolved
Hide resolved
e9a4607
to
ba269ea
Compare
import { GridGetRowsParams, GridGetRowsResponse, GridDataSourceCache } from '../../../models'; | ||
import { GridDataSourceCacheApi } from './interfaces'; | ||
|
||
class SimpleServerSideCache { |
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.
While this simple cache is enough for demo purposes, we should provide a more advanced cache implementation required for real-world use cases – at least with configurable cache time.
What do you think?
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 wanted to make the default cache as simple as possible, but I agree ttl
could be added, as it's one of the most basic features of a cache. Added!
Let me know if it feels better now.
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Part of #8179
Resolves #3377
Previews:
Server side tree data with server-side indexed pagination, sorting, filtering, and caching: https://deploy-preview-12317--material-ui-x.netlify.app/x/react-data-grid/server-side-data/tree-data/
Plain data server-side pagination, filtering, and sorting: https://deploy-preview-12317--material-ui-x.netlify.app/x/react-data-grid/server-side-data/#usage
Action items:
pagination.rowCount
a controlled state (extracted to [DataGrid] MakerowCount
part of the state #12381)useDemoDataSource
)rows
an optional prop (extracted to [DataGrid] Makerows
an optional prop #12478)rowCount
(extracted to [DataGrid] Support advanced server-side pagination use cases #12474)defaultGroupingExpansionDepth
andisGroupExpandedByDefault
swr
andreact-query
copy-paste
rowTreeCreation
and other processes of rows pre-processingDataSource
vsDataManager
vsDataProvider
vs ?)loading
a controlled prop ?Follow-up Items (for subsequent PRs):