Skip to content

Commit 80e9402

Browse files
committed
destroy if observer has no callback
1 parent 3873b5b commit 80e9402

File tree

1 file changed

+6
-0
lines changed
  • src/Umbraco.Web.UI.Client/src/libs/observable-api

1 file changed

+6
-0
lines changed

src/Umbraco.Web.UI.Client/src/libs/observable-api/observer.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,19 @@ export class UmbObserver<T> {
3232
wantedToClose = true;
3333
} else {
3434
subscription.unsubscribe();
35+
if (!this.#callback) {
36+
this.destroy();
37+
}
3538
}
3639
resolve(value as Exclude<T, undefined>);
3740
}
3841
});
3942
initialCallback = false;
4043
if (wantedToClose) {
4144
subscription.unsubscribe();
45+
if (!this.#callback) {
46+
this.destroy();
47+
}
4248
}
4349
});
4450
}

0 commit comments

Comments
 (0)