DataGrid: Fix extra request for the first page on load when starting on another page (T1326786) - #34512
Open
Alyar666 wants to merge 1 commit into
Open
DataGrid: Fix extra request for the first page on load when starting on another page (T1326786)#34512Alyar666 wants to merge 1 commit into
Alyar666 wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an unnecessary extra data load triggered during DataGrid initialization when virtual scrolling starts on a non-first page (especially noticeable with asynchronously-rendered templates), ensuring only the intended page request is issued.
Changes:
- Added a guard in virtual scrolling viewport update logic to prevent
loadViewportfrom firing while the initial scroll-to-page positioning is still pending. - Simplified/clarified viewport “needs more items” calculation by normalizing
takevalues. - Added a TestCafe e2e regression test that validates only one remote load request occurs on init for a non-first page scenario (T1326786).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/devextreme/js/__internal/grids/grid_core/virtual_scrolling/m_virtual_scrolling.ts | Prevents updateViewport() from triggering an extra load until the viewport is positioned to the configured initial page. |
| e2e/testcafe-devextreme/tests/dataGrid/common/scrolling.ts | Adds an e2e regression test asserting a single { skip, take } request when initializing on a non-first page with async templates. |
…on another page (T1326786)
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
e2e/testcafe-devextreme/tests/dataGrid/common/scrolling.ts:2179
- The test asserts the collected load options immediately after
isReady(), but the extra request this regression targets can be triggered asynchronously (e.g., after delayed template rendering). As written, the test can pass even if a second request happens shortly after the assertion. Add a short wait and re-check the collected options to ensure no delayed extra request occurs.
await t.expect(dataGrid.isReady()).ok();
await t.expect(dataGrid.getScrollTop()).gt(0);
await t.expect(dataGrid.apiPageIndex()).eql(10);
const loadOptions = await getTestLoadOptions();
await t.expect(loadOptions).eql([{ skip: 1000, take: 100 }]);
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.
No description provided.