React Native triggers below error if we try to use waitForInitialization={false} in the StatsigProvider and try to read value with useConfig or similar APIs. Docs mention this error and a way to silent it but that introduces an ENV that can silent other valid errors as well 😅.
Reason
Currently, this gets triggered if we use StatsigProvider on React Native with waitForInitialization false and if we try to use for e.g. useConfig hook. The same doesn't happen on web. This is because web relies on localStorage which initialises synchronously and React native uses AsyncStorage. React Native has evolved a lot and there are better options like MMKV that can be used to save/retrieve values synchronously. I was thinking if i can quickly contribute to the feature but seems like codebase relies heavily on StatsigAsyncStorage.asyncStorage so surely requires decent amount of changes and testing. Maybe we can add waitForLoad prop so we only wait for AsyncStorage cache load instead of network too? or maybe you all can migrate to MMKV and fix this issue from the root 😄. There are surely tradeoffs on depending upon an external library or maybe some architecture change where you introduce syncPersistor, asyncPersistor adaptors etc. So users can use localStorage or AsyncStorage or MMKV.
React Native triggers below error if we try to use
waitForInitialization={false}
in the StatsigProvider and try to read value withuseConfig
or similar APIs. Docs mention this error and a way to silent it but that introduces an ENV that can silent other valid errors as well 😅.Reason
Currently, this gets triggered if we use
StatsigProvider
on React Native withwaitForInitialization
false and if we try to use for e.g.useConfig
hook. The same doesn't happen on web. This is because web relies on localStorage which initialises synchronously and React native uses AsyncStorage. React Native has evolved a lot and there are better options like MMKV that can be used to save/retrieve values synchronously. I was thinking if i can quickly contribute to the feature but seems like codebase relies heavily onStatsigAsyncStorage.asyncStorage
so surely requires decent amount of changes and testing. Maybe we can addwaitForLoad
prop so we only wait for AsyncStorage cache load instead of network too? or maybe you all can migrate to MMKV and fix this issue from the root 😄. There are surely tradeoffs on depending upon an external library or maybe some architecture change where you introduce syncPersistor, asyncPersistor adaptors etc. So users can use localStorage or AsyncStorage or MMKV.