From 0f32037e703f0ae21b829d7c513b011b290d80bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20R=C3=A9?= Date: Wed, 13 May 2026 18:30:58 +0400 Subject: [PATCH] Fix duplicate callback dispatch in ConsentManager.subscribe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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é --- packages/cookie-banner/src/consent.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/cookie-banner/src/consent.ts b/packages/cookie-banner/src/consent.ts index db6ae72aa..2b9e4bcbd 100644 --- a/packages/cookie-banner/src/consent.ts +++ b/packages/cookie-banner/src/consent.ts @@ -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(); };