Skip to content

Commit

Permalink
Fix components not being spliced from the state when removed
Browse files Browse the repository at this point in the history
  • Loading branch information
Starmapo committed Sep 5, 2024
1 parent 28bb710 commit e70cbff
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions haxe/ui/backend/ScreenImpl.hx
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,17 @@ class ScreenImpl extends ScreenBase {
if (rootComponents.indexOf(component) != -1) {
throw "component wasnt actually removed from array, or there is a duplicate in the array";
}
if (StateHelper.currentState.exists == true) {
StateHelper.currentState.remove(component, true);
}
// Destroying a sprite makes it get removed from its container (in this case, the state) without
// being spliced, causing issues later with `addComponent()` not actually adding components on top
// of everything else, so this has to go after the component has been properly removed.
if (dispose) {
component.disposeComponent();
} else {
component.applyRemoveInternal();
}
if (StateHelper.currentState.exists == true) {
StateHelper.currentState.remove(component, true);
}
checkResetCursor();
onContainerResize();
return component;
Expand Down

0 comments on commit e70cbff

Please sign in to comment.