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
Conversation
Contributor
There was a problem hiding this comment.
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 |
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)
cc7314e to
05dac8e
Compare
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.