Fix duplicate callback dispatch in ConsentManager.subscribe
When `_ready` was already true, `subscribe` called `cb` directly and then `onReady` called it again, producing duplicate side effects. Remove the redundant direct call since `onReady` already handles the immediate-dispatch case. Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -39,9 +39,6 @@ export class ConsentManager {
|
||||
}
|
||||
|
||||
subscribe(cb: Callback): () => void {
|
||||
if (this._ready) {
|
||||
cb(this._snapshot);
|
||||
}
|
||||
const offReady = this.onReady(cb);
|
||||
const offChange = this.onChange(cb);
|
||||
return () => { offReady(); offChange(); };
|
||||
|
||||
Reference in New Issue
Block a user