fixing moving observable in DOM

This commit is contained in:
Niels Lyngsø
2023-03-15 14:02:11 +01:00
parent 4e5900c25f
commit ab08024e7f
3 changed files with 9 additions and 2 deletions

View File

@@ -37,7 +37,9 @@ export class UmbContextConsumer<HostType extends EventTarget = EventTarget, T =
protected _onResponse = (instance: T) => {
// TODO: check that this check is not giving us any problems:
if (this._instance === instance) return;
if (this._instance === instance) {
return;
}
this._instance = instance;
this._callback?.(instance);
this._promiseResolver?.(instance);

View File

@@ -12,7 +12,8 @@ export class UmbObserver<T> {
// Notice controller class implements empty hostConnected().
hostDisconnected() {
this.#subscription.unsubscribe();
// No cause then it cant re-connect, if the same element just was moved in DOM.
//this.#subscription.unsubscribe();
}
destroy(): void {

View File

@@ -21,6 +21,10 @@ export class UmbWorkspaceSplitViewManager {
constructor(host: UmbControllerHostInterface) {
this.#host = host;
this.activeVariantsInfo.subscribe((data) => {
console.log('— activeVariantsInfo 1 updated: ', data);
});
}
private _routeBase?: string;