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:
Émile Ré
2026-05-13 18:30:58 +04:00
committed by Émile Ré
parent c17757565f
commit 0f32037e70

View File

@@ -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(); };