Skip to content

fix(hierarchicalGrid): Ensure col instances created from ri cols are … - #17508

Open
MayaKirova wants to merge 1 commit into
21.2.xfrom
mkirova/fix-17502-21.2.x
Open

fix(hierarchicalGrid): Ensure col instances created from ri cols are …#17508
MayaKirova wants to merge 1 commit into
21.2.xfrom
mkirova/fix-17502-21.2.x

Conversation

@MayaKirova

Copy link
Copy Markdown
Contributor

…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:

  • All relevant tags have been applied to this PR
  • This PR includes unit tests covering all the new code (test guidelines)
  • This PR includes API docs for newly added methods/properties (api docs guidelines)
  • This PR includes feature/README.MD updates for the feature docs
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes ng update migrations for the breaking changes (migrations guidelines)
  • This PR includes behavioral changes and the feature specification has been updated with them
  • Accessibility (ARIA, keyboard navigation, focus management) has been verified

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.

Pull request overview

This PR addresses a memory leak in the Hierarchical Grid by explicitly destroying dynamically created column component instances that are cloned from Row Island declarative column definitions for child grids. This aligns the child-grid column lifecycle with the grid’s own teardown lifecycle so detached DOM/components don’t remain referenced after destruction.

Changes:

  • Track ComponentRef instances for columns created via createComponent() when cloning Row Island columns into a child grid.
  • Include nested (column-group children) created column refs in that tracking.
  • Destroy all tracked refs during ngOnDestroy() to prevent leaked column component instances.

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

Comment on lines 144 to 148
topLevelCols.forEach((col) => {
col.grid = this;
const ref = this._createColumn(col);
this._rowIslandColumnRefs.push(ref);
ref.changeDetectorRef.detectChanges();
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.

3 participants