fix various single-containers

This commit is contained in:
Aran-Fey
2024-06-15 14:57:15 +02:00
committed by Jakob Pinterits
parent e0c19ba166
commit 0cdc77dace
18 changed files with 64 additions and 80 deletions
+14 -10
View File
@@ -41,25 +41,29 @@ export class SwitcherComponent extends ComponentBase {
deltaState.content !== undefined &&
deltaState.content !== this.state.content
) {
this.removeCurrentChild(latentComponents);
this.addNewChild(deltaState.content, latentComponents);
this.replaceContent(deltaState.content, latentComponents);
}
}
private replaceContent(
content: ComponentId | null,
latentComponents: Set<ComponentBase>
): void {}
private removeCurrentChild(latentComponents: Set<ComponentBase>): void {
if (this.activeChildContainer === null) {
return;
}
// The old component may be used somewhere else in the UI, so
// the switcher can't rely on it still being available. To get
// around this, create a copy of the element's HTML tree and use
// that for the animation.
// The old component may be used somewhere else in the UI, so the
// switcher can't rely on it still being available. To get around this,
// create a copy of the element's HTML tree and use that for the
// animation.
//
// Moreover, teh component may have already been removed from
// the switcher. This can happen when it was moved into another
// component. Thus, fetch the component by its id, rather than
// using the contained HTML node.
// Moreover, the component may have already been removed from the
// switcher. This can happen when it was moved into another component.
// Thus, fetch the component by its id, rather than using the contained
// HTML node.
let oldComponent = componentsById[this.state.content!]!;
let oldElementClone = oldComponent.element.cloneNode(
true