You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ThisuseEffect will mount and execute on every single render. The root cause is that getCurrentDecision in useDecision is not wrapped in useCallback like it is in the other hooks.
constgetCurrentDecision: ()=>{decision: OptimizelyDecision}=()=>({decision: optimizely.decide(flagKey,options.decideOptions,overrides.overrideUserId,overrideAttrs),});
...
useEffect(()=>{// Subscribe to update after first datafile is fetched and readyPromise is resolved to avoid redundant rendering.if(optimizely.getIsReadyPromiseFulfilled()&&options.autoUpdate){returnsetupAutoUpdateListeners(optimizely,HookType.FEATURE,flagKey,hooksLogger,()=>{setState(prevState=>({
...prevState,
...getCurrentDecision(),}));});}return(): void=>{};},[optimizely.getIsReadyPromiseFulfilled(),options.autoUpdate,optimizely,flagKey,getCurrentDecision]);