Skip to content

Grids: retarget counting methods to dataSourceController - #35131

Open
anna-shakhova wants to merge 5 commits into
DevExpress:mainfrom
anna-shakhova:retarget_counting_main
Open

Grids: retarget counting methods to dataSourceController#35131
anna-shakhova wants to merge 5 commits into
DevExpress:mainfrom
anna-shakhova:retarget_counting_main

Conversation

@anna-shakhova

Copy link
Copy Markdown
Contributor

No description provided.

@anna-shakhova anna-shakhova self-assigned this Sep 9, 2026
Copilot AI lite review requested due to automatic review settings September 9, 2026 13:16
@anna-shakhova
anna-shakhova requested a review from a team as a code owner September 9, 2026 13:16

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.

Note

Copilot was unable to run its full agentic suite in this review.

Pull request overview

Retargets hasKnownLastPage from DataController to DataSourceController and updates grid pager/virtual scrolling code and tests to use the new location.

Changes:

  • Added DataSourceController.hasKnownLastPage() and unit tests for delegation/default behavior.
  • Updated pager + virtual scrolling logic to call dataSourceController.hasKnownLastPage() instead of dataController.hasKnownLastPage().
  • Updated QUnit tests and added a Jest integration test for PagerView to validate pager options/visibility.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/pagerView.tests.js Updates pager QUnit test to assert against dataSourceController.hasKnownLastPage().
packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/dataController.tests.js Repoints multiple assertions to dataSourceController.hasKnownLastPage().
packages/devextreme/testing/helpers/gridBaseMocks.js Moves hasKnownLastPage mock to align with the controller responsibility shift.
packages/devextreme/js/__internal/grids/grid_core/virtual_scrolling/m_virtual_scrolling.ts Uses dataSourceController.hasKnownLastPage() for bottom-loading visibility checks.
packages/devextreme/js/__internal/grids/grid_core/virtual_scrolling/extenders/virtual_scrolling_data_controller.ts Delegates hasKnownLastPage checks to dataSourceController.
packages/devextreme/js/__internal/grids/grid_core/pager/m_pager.ts Pager now reads hasKnownLastPage from dataSourceController; adds controller field.
packages/devextreme/js/__internal/grids/grid_core/pager/tests/pager_view.integration.test.ts New integration tests covering pager options and auto-visibility.
packages/devextreme/js/__internal/grids/grid_core/data_source/data_source_controller.ts Adds hasKnownLastPage() API with safe default when no adapter.
packages/devextreme/js/__internal/grids/grid_core/data_source/tests/data_source_controller.test.ts Tests default true and adapter delegation for hasKnownLastPage().
packages/devextreme/js/__internal/grids/grid_core/data_controller/data_controller.ts Removes DataController.hasKnownLastPage() implementation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/devextreme/js/__internal/grids/grid_core/pager/m_pager.ts
Comment thread packages/devextreme/js/__internal/grids/grid_core/pager/m_pager.ts
Comment thread packages/devextreme/js/__internal/grids/grid_core/pager/m_pager.ts
Comment thread packages/devextreme/js/__internal/grids/grid_core/pager/m_pager.ts
Comment thread packages/devextreme/js/__internal/grids/grid_core/pager/m_pager.ts
@anna-shakhova anna-shakhova changed the title Grids: retarget hasKnownLastPage method Grids: retarget counting methods to dataSourceController Sep 9, 2026
Copilot AI review requested due to automatic review settings September 9, 2026 13:57

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.

🟡 Changes recommended

The updated test mock MockDataSourceAdapter.totalItemsCount() can return undefined, which can propagate into production-like code paths and produce NaN in numeric computations.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 19/19 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread packages/devextreme/testing/helpers/gridBaseMocks.js
Copilot AI review requested due to automatic review settings September 9, 2026 14:33

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.

🟡 Changes recommended

The updated test adapter in gridBaseMocks.js can return undefined/coerce valid values for counts, which can break DataSourceController-based logic and cause incorrect behavior in tests/runtime.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 24/24 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread packages/devextreme/testing/helpers/gridBaseMocks.js
Copilot AI review requested due to automatic review settings September 9, 2026 15:00

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.

🔵 Needs a closer look

The updated test mocks can return undefined for pageCount/totalItemsCount, which diverges from production defaults and can break arithmetic/comparisons in code paths that now rely on dataSourceController.

Review details

Suppressed comments (3)

Previously missed (2) — in code that hasn't changed since the last review.

packages/devextreme/js/__internal/grids/grid_core/data_source/tests/data_source_controller.integration.test.ts:80

  • The test name says the controller "sits at the bottom" of the controller order, but the assertion checks that it's the first entry. Consider renaming the test to match the expectation (e.g., "is created first"), so future readers don’t misinterpret the intended ordering.
  it('sits at the bottom of the controller order', async () => {
    const { instance } = await createDataGrid({ dataSource: DATA });

    expect(getControllerNames(instance)[0]).toBe('dataSource');
  });

packages/devextreme/testing/helpers/gridBaseMocks.js:69

  • MockDataSourceAdapter.pageCount() can return undefined when options.pageCount is not provided, but the real DataSourceController.pageCount() defaults to 1. Returning undefined can break code paths that do arithmetic like pageCount() - 1.

packages/devextreme/testing/helpers/gridBaseMocks.js:63

  • MockDataSourceAdapter.totalItemsCount() can return undefined when options.totalItemsCount is not provided, but callers (and the real DataSourceController.totalItemsCount()) expect a number (defaulting to 0). This can lead to NaN/incorrect comparisons in tests using these mocks.
            totalItemsCount: function() {
                return options.totalItemsCount;
            },
  • Files reviewed: 25/25 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants