-
Notifications
You must be signed in to change notification settings - Fork 160
fix(action-strip): Assign parent to not destroy on DOM move. #16270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
5ac7a0d
01683e7
fbd1785
a8642fd
ec11d6d
7201841
89b1eb8
f18b2f4
9399e0b
a0e57de
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -279,6 +279,9 @@ export class IgxActionStripComponent implements IgxActionStripToken, AfterConten | |
| * ``` | ||
| */ | ||
| public show(context?: any): void { | ||
| if(!this._originalParent) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, if every workflow goes through Anyway, I'm assuming this fixes the disappearing strip if it inits in some case as detached, but still is attached before showing. |
||
| this._originalParent = this._viewContainer.element.nativeElement?.parentElement; | ||
| } | ||
| this.hidden = false; | ||
| if (!context) { | ||
| return; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -147,7 +147,7 @@ export class IgxGridEditingActionsComponent extends IgxGridActionsBaseDirective | |
| const context = this.strip.context; | ||
| const grid = context.grid; | ||
| grid.deleteRow(context.key); | ||
|
|
||
| this.grid.cdr.detectChanges(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, the original parent bit I get, but do we really need this? Any context why a full grid change detection is needed/doing?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Surely the deletion and CRUD service will also do that if needed, so this one would be extra even.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I no longer remember the details, since it has been a while, however I can confirm that the code does not work without the change detection (the issue reproduces without the change detection and is fixed with the change detection).
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @damyanpetev Here are a few observation. The issue is specifically when you delete the last row and there's no next row in the grid, for example you have a grid with only 2 rows and you delete the second one. So this means that the RowComponent associated with the row will be destroyed. The issue happens when the moment the row is destroyed the action strip is still inside it:
Hence the destroy and removal of the row, also removes and destroys the action strip. To me it seems that the logic that moves the action strip back to the root of the grid, the one inside the Happens asynchronously - so it does not immediately move it to the root in time, before angular goes and destroys the parent. So regardless of the order: or It never manages to move the strip out of the row in time. Also another fun observation - if you debug the Adding a change detection somewhere in the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @MayaKirova you're right to suspect something async happening, sure, except it's not the What I'm actually observing is quite interesting: works exactly as it should and moves the strip back to the grid element (can confirm with a simple log to avoid messing with timing during debug). Except something else moves the strip back to the row and gets it deleted permanently from the DOM by destroying the row. That's why the Logpoint at the end of So the actual issue which I haven't dug out yet - why on earth is the action strip returning to its row just before it gets destroyed so it can deleted along with its DOM host.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @damyanpetev It seems to me that the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| this.strip.hide(); | ||
|
damyanpetev marked this conversation as resolved.
|
||
| } | ||
|
|
||
|
|
||





Uh oh!
There was an error while loading. Please reload this page.