Skip to content

Commit

Permalink
fix(cdk): when the consumer unsubscribes, clean up data ready for nex…
Browse files Browse the repository at this point in the history
…t subscription
  • Loading branch information
splincode committed Jan 25, 2024
1 parent 75f9762 commit c6bcacc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion projects/cdk/observables/control-value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ export function tuiControlValue<T>(
throw new TuiValueChangesException();
}

control.valueChanges.pipe(startWith(control.value)).subscribe(subscriber);
const subscription = control.valueChanges
.pipe(startWith(control.value))
.subscribe(subscriber);

return () => subscription.unsubscribe();
});
}

0 comments on commit c6bcacc

Please sign in to comment.