fix(hierarchicalGrid): Ensure col instances created from ri cols are … - #17503
fix(hierarchicalGrid): Ensure col instances created from ri cols are …#17503MayaKirova wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses a reported memory leak in the Hierarchical Grid by ensuring dynamically created column component instances (spawned for child grids from RowIsland declarative column definitions) are explicitly destroyed when the target grid is torn down.
Changes:
- Track
ComponentRefs created viacreateComponent()when building child-grid columns from RowIsland column declarations. - Add cleanup on grid destruction to destroy those tracked
ComponentRefs and clear the tracking collection.
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
| /* blazorSuppress */ | ||
| public abstract expandChildren: boolean; | ||
|
|
||
| protected _rowIslandColumnRefs: ComponentRef<IgxColumnComponent>[] = []; |
There was a problem hiding this comment.
@copilot IgxColumnGroupComponent extends IgxColumnComponent, so it should be fine, shouldn't it?
There was a problem hiding this comment.
Yes, that's fine. IgxColumnGroupComponent extends IgxColumnComponent, so ComponentRef<IgxColumnGroupComponent> is assignable to ComponentRef<IgxColumnComponent> and the array type covers both cases. We only ever call ref.destroy() on the stored refs, so the base type is sufficient here — no change needed.
| public override ngOnDestroy() { | ||
| this.destroyRowIslandColumnRefs(); | ||
| super.ngOnDestroy(); | ||
| } |
…destroyed.
Closes #17502
Description
Destroy column instances that are created for child grids from row island column declarations, since they seem to remain after target grid is destroyed for some reason.
Checklist:
feature/README.MDupdates for the feature docsREADME.MDCHANGELOG.MDupdates for newly added functionalityng updatemigrations for the breaking changes (migrations guidelines)