Skip to content

Commit b5e4806

Browse files
authored
Merge pull request #17943 from umbraco/v15/feature/no-callback-then-destroy
Feature: no callback then destroy
2 parents 836d526 + 80e9402 commit b5e4806

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)