Skip to content

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
DevExpress:mainfrom
Alyar666:T1326786_26_2
Open

DataGrid: Fix extra request for the first page on load when starting on another page (T1326786)#34512
Alyar666 wants to merge 1 commit into
DevExpress:mainfrom
Alyar666:T1326786_26_2

Conversation

@Alyar666

Copy link
Copy Markdown
Contributor

No description provided.

@Alyar666 Alyar666 self-assigned this Jul 27, 2026
Copilot AI review requested due to automatic review settings July 27, 2026 22:27
@Alyar666
Alyar666 requested a review from a team as a code owner July 27, 2026 22:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 loadViewport from firing while the initial scroll-to-page positioning is still pending.
  • Simplified/clarified viewport “needs more items” calculation by normalizing take values.
  • 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.

Copilot AI review requested due to automatic review settings July 28, 2026 07:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 }]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants