If I attempt to set a previously defined memoized value to a list of values of length one, no error throws. If I set it to a list of length > 2 I get the following error
Error: You attempted to set the key `0` with the value `"acmemarkets"` on an object that is meant to be immutable and has been frozen.
SelectedStores
is a value stored in a context - Relevant example code
const logAnalyticsEvent = useCallback( (feelingHungryActionType: FeelingHungryActionType) => { logFeelingHungryAction({ feelingHungryActionType, dietId: dietId ?? null, productUpcBeingViewed: currentProduct?.upc ?? null, selectedStores: selectedStores ?? [StoreNames.BrowseAllStores], greenOnly, feelingHungryAfterLikeAutoCloseDelayInMs, feelingHungryHowManyProductsToKeepInPreloadBuffer, feelingHungryHowManyProductsToLoadPerRequest, }); }, [ dietId, currentProduct, selectedStores, greenOnly, feelingHungryAfterLikeAutoCloseDelayInMs, feelingHungryHowManyProductsToKeepInPreloadBuffer, feelingHungryHowManyProductsToLoadPerRequest, logFeelingHungryAction, ], );
If I change this to simply return a copy of selectedStores
using
selectedStores.map(store=>store)