@@ -184,15 +184,31 @@ export class ProviderStateStore {
184184 }
185185
186186 /**
187- * Notify listeners subscribed to a specific flagKey.
188- * Also notifies "all" forced decision listeners.
189- * Called internally by wrapped forced decision methods .
187+ * Notify listeners subscribed to a specific flagKey
188+ * and broadcast to "all" forced decision listeners.
189+ * Called by wrapped setForcedDecision / removeForcedDecision .
190190 */
191191 notifyForcedDecision ( flagKey : string ) : void {
192+ this . notifyPerKeyForcedDecision ( flagKey ) ;
193+ this . notifyAllForcedDecisionListeners ( ) ;
194+ }
195+
196+ /**
197+ * Notify only per-key listeners (no broadcast).
198+ * Used internally by removeAllForcedDecisions to avoid
199+ * firing "all" listeners once per key.
200+ */
201+ private notifyPerKeyForcedDecision ( flagKey : string ) : void {
192202 const listeners = this . forcedDecisionListeners . get ( flagKey ) ;
193203 if ( listeners ) {
194204 listeners . forEach ( ( cb ) => cb ( ) ) ;
195205 }
206+ }
207+
208+ /**
209+ * Notify broadcast ("all") forced decision listeners once.
210+ */
211+ private notifyAllForcedDecisionListeners ( ) : void {
196212 this . allForcedDecisionListeners . forEach ( ( cb ) => cb ( ) ) ;
197213 }
198214
@@ -240,7 +256,9 @@ export class ProviderStateStore {
240256 const result = originalRemoveAll ( ) ;
241257 if ( result ) {
242258 if ( this . state . userContext === ctx ) {
243- forcedDecisionFlagKeys . forEach ( ( flagKey ) => this . notifyForcedDecision ( flagKey ) ) ;
259+ // Notify per-key listeners individually, then broadcast once
260+ forcedDecisionFlagKeys . forEach ( ( flagKey ) => this . notifyPerKeyForcedDecision ( flagKey ) ) ;
261+ this . notifyAllForcedDecisionListeners ( ) ;
244262 }
245263 forcedDecisionFlagKeys . clear ( ) ;
246264 }
0 commit comments