fix(grid): preserve refs and return new array to reflect changes#17320
Open
IvanKitanov17 wants to merge 2 commits into
Open
fix(grid): preserve refs and return new array to reflect changes#17320IvanKitanov17 wants to merge 2 commits into
IvanKitanov17 wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses #17317 by ensuring IgxGridComponent.addRow() / deleteRow() keep the originally bound data source in sync (instead of breaking the reference by reassigning grid.data) while still triggering the grid pipeline to reflect in-place mutations.
Changes:
- Updated the grid transaction pipe to always return a new array reference when transactions are disabled.
- Updated
addRowToData/deleteRowFromDatato mutategrid.datain place (preserving the original array reference) and clear summary caches instead of cloning/reassigning the data array. - (Recommended) Add regression tests to assert the externally bound array is updated across repeated add/delete calls when transactions are disabled.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
projects/igniteui-angular/grids/core/src/common/pipes.ts |
Returns a shallow-copied array in IgxGridTransactionPipe when transactions are disabled so downstream pipeline/virtualization sees a new reference. |
projects/igniteui-angular/grids/core/src/api.service.ts |
Stops reassigning grid.data on add/delete (preserves bound array ref) and clears summary cache after in-place mutations. |
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.
Closes #17317
Description
Motivation / Context
When using the addRow and deleteRow methods of the grid the data source is not being updated.
Type of Change (check all that apply):
Component(s) / Area(s) Affected:
Grids
How Has This Been Tested?
Test Configuration:
Screenshots / Recordings
Checklist:
feature/README.MDupdates for the feature docsREADME.MDCHANGELOG.MDupdates for newly added functionalityng updatemigrations for the breaking changes (migrations guidelines)