Skip to content

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

Open
MayaKirova wants to merge 1 commit into
masterfrom
mkirova/fix-17502
Open

fix(hierarchicalGrid): Ensure col instances created from ri cols are …#17503
MayaKirova wants to merge 1 commit into
masterfrom
mkirova/fix-17502

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

@MayaKirova
MayaKirova requested a review from dkamburov August 12, 2026 12:33
Copilot AI lite review requested due to automatic review settings August 12, 2026 12:33

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 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 via createComponent() 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>[] = [];

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@copilot IgxColumnGroupComponent extends IgxColumnComponent, so it should be fine, shouldn't it?

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.

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.

Comment on lines +223 to +226
public override ngOnDestroy() {
this.destroyRowIslandColumnRefs();
super.ngOnDestroy();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IgxHierarchicalGrid - DOM elements remain in memory after destroy.

4 participants