Repository navigation
[data grid] Stop the lazy loading polling when lazyLoading turns off - #23717
Merged
LukasTy merged 3 commits intoOct 1, 2026
Merged
Conversation
`useGridDataSourceBase` and the two lazy loaders repeated the same polling setup. `useGridDataSourcePolling` now owns the interval and the flag that blocks a restart after unmount or while an `<Activity>` is hidden. It also resumes the polling when the `<Activity>` shows the grid again. The queued sort fetch test now waits for the row id. The old check passed on `undefined` before the grid mounted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When `lazyLoading` turned off, the flat lazy loader continued to poll the old lazy range. The `Default` strategy applied those responses, so the rows alternated between the current page and the old range. `useGridDataSourcePolling` now stops the polling when `isActive` is `false` or `revalidateMs` is `0` or less. This effect replaces the stop effects in `useGridDataSourceBase` and in the two lazy loaders. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Deploy previewBundle size
Check out the code infra dashboard for more information about this PR. |
Contributor
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
…chandrasekhar-904361 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LukasTy
marked this pull request as ready for review
September 30, 2026 13:56
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The centralized fix matches existing behavior and the regression test covers the reported failure.
Review effort: Balanced
Findings: None
What changed in this PR
Centralizes polling shutdown logic so inactive data-source strategies cannot continue stale revalidation.
Changes:
- Stops polling when
isActiveis false or the interval is non-positive. - Removes redundant caller-level shutdown effects.
- Adds a regression test for disabling flat lazy loading during polling.
| File | Description |
|---|---|
packages/x-data-grid/src/hooks/features/dataSource/useGridDataSourcePolling.ts |
Centralizes polling shutdown. |
packages/x-data-grid/src/hooks/features/dataSource/useGridDataSourceBase.ts |
Removes redundant effects. |
packages/x-data-grid-pro/src/tests/dataSourceLazyLoader.DataGridPro.test.tsx |
Tests disabling lazy loading. |
packages/x-data-grid-pro/src/hooks/features/serverSideLazyLoader/useGridDataSourceNestedLazyLoader.ts |
Uses centralized shutdown. |
packages/x-data-grid-pro/src/hooks/features/serverSideLazyLoader/useGridDataSourceLazyLoader.ts |
Uses centralized shutdown. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
JCQuintas
approved these changes
Sep 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #23714.
When
lazyLoadingturns off, the active strategy becomesDefault, but the flat lazy loader does not stop its polling. Its interval continues to callrevalidate(params)with the old lazy range, and theDefaultstrategy applies each response withsetRows(). The visible rows then alternate between the current page and the old lazy range.useGridDataSourceBaseand the nested lazy loader already stop the polling when their strategy turns inactive. The flat lazy loader stops it only whendataSourceRevalidateMsis0or less.useGridDataSourcePollingnow stops the polling whenisActiveisfalseorrevalidateMsis0or less.This effect replaces the stop effects in
useGridDataSourceBase(two) and in each lazy loader (one).A new test turns off
lazyLoadingwhile the flat lazy loader polls. The test fails without the fix.I have followed (at least) the PR section of the contributing guide.
Generated with Claude Code