Skip to content

Commit

Permalink
fix: onDispose should return dispose function if no scope
Browse files Browse the repository at this point in the history
  • Loading branch information
mihar-22 committed Nov 30, 2022
1 parent 3e70c2e commit ca04b24
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/observables.ts
Expand Up @@ -374,7 +374,7 @@ export function onError<T = Error>(handler: (error: T) => void): void {
* @see {@link https://github.com/maverick-js/observables#ondispose}
*/
export function onDispose(dispose: MaybeDispose): Dispose {
if (!dispose || !currentScope) return NOOP;
if (!dispose || !currentScope) return dispose || NOOP;
(currentScope[DISPOSAL] ??= new Set()).add(dispose);
return () => {
(dispose as Dispose)();
Expand Down

0 comments on commit ca04b24

Please sign in to comment.