Skip to content

DataGrid: Fix the "Cannot read properties of undefined (reading 'values')" error that occurs when adding a row to the second page if initial row values are specified in onInitNewRow (T1274123)#32448

Open
Alyar666 wants to merge 4 commits intoDevExpress:26_1from
Alyar666:T1274123_26_1

Conversation

@Alyar666
Copy link
Contributor

@Alyar666 Alyar666 commented Feb 6, 2026

No description provided.

@Alyar666 Alyar666 self-assigned this Feb 6, 2026
@Alyar666 Alyar666 requested a review from a team as a code owner February 6, 2026 08:35
Copilot AI review requested due to automatic review settings February 6, 2026 08:35
@Alyar666 Alyar666 added the 26_1 label Feb 6, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug where adding rows to the second page of a DataGrid with initial values specified in onInitNewRow caused a "Cannot read properties of undefined (reading 'values')" error. The root cause was that internal state data was not being properly cleaned up after save operations, leading to stale or missing internal data on subsequent operations.

Changes:

  • Fixes internal state management in the editing controller by cleaning up internal data after each change is saved
  • Adds optional chaining to safely access internal data that may not exist
  • Adds a method to update internal data keys when they change during insert operations
  • Adds comprehensive unit tests for internal state cleanup
  • Adds TestCafe e2e test to verify the specific scenario

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/devextreme/js/__internal/grids/grid_core/editing/m_editing.ts Core fix: adds updateInternalDataKey method, changes _fireSaveEditDataEvents to use _getInternalData instead of _addInternalData, adds cleanup call _removeInternalData, and adds debug method getInternalStateSize for testing
packages/devextreme/js/__internal/grids/grid_core/editing/tests/m_editing.integration.test.ts Adds comprehensive Jest tests for internal state cleanup in various scenarios (update, insert, delete, multiple operations, cancel, and error cases)
packages/devextreme/js/__internal/grids/grid_core/tests/mock/helpers/utils.ts Updates TypeScript types to expose getController method for accessing editing controller in tests
packages/testcafe-models/dataGrid/index.ts Adds getEditPopup method and extends apiPageIndex to support setting page index (for TestCafe tests)
packages/testcafe-models/dataGrid/editPopup.ts New file: creates EditPopup model extending Popup for TestCafe tests
e2e/testcafe-devextreme/tests/dataGrid/common/editing/functional.ts Adds e2e test that reproduces the specific scenario: adding rows to second page with onInitNewRow initial values

Alyar added 2 commits February 6, 2026 17:07
…es')" error that occurs when adding a row to the second page if initial row values are specified in onInitNewRow (T1274123)
Copilot AI review requested due to automatic review settings February 6, 2026 14:28
Copy link
Contributor

Copilot AI left a comment

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 7 out of 7 changed files in this pull request and generated no new comments.

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.

1 participant