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
@segment/sovran-react-native's export createStore has a persist option that allows for you to provide a Persistor. This is great for being able to leverage a faster storage library like MMKV.
However the createClient export of @segment/analytics-react-native does not pass through any config options to it's SovranStorage class which makes createStore function calls. Except for writeKey that is which maps to storeId in the SovranStorage class.
Proposed Solution
createClient export's Config argument should include an option for storePersistor. Which will match the Persistor interface of @segment/sovran-react-native
SovranStorage class needs either a second argument for storePersistor or it needs to have it own Config interface for the argument to support a storeId and storePersistor options.
All createStore calls in SovranStorage class must pass persistor property in the persist object option.
The text was updated successfully, but these errors were encountered:
509dave16
changed the title
[feat] storePersistor Pass Through Option for createStore calls
[feat] storePersistor Pass through option for createStore calls
May 16, 2022
509dave16
changed the title
[feat] storePersistor Pass through option for createStore calls
[feat] storePersistor option for createClient to pass through for createStore calls
May 16, 2022
509dave16
added a commit
to 509dave16/analytics-react-native
that referenced
this issue
May 19, 2022
Hi @509dave16 , I was curious if you could provide an example of making this work with MMKV. I've tried adding the MMKV storage to storePersistor:
storePersistor: storage
Where storage is equal to new MMKV()
However, it's not working and of course, I am getting type errors where the methods don't align. How did you go about integrating this? Really appreciate it.
Summary
@segment/sovran-react-native
's export createStore has apersist
option that allows for you to provide aPersistor
. This is great for being able to leverage a faster storage library like MMKV.However the
createClient
export of@segment/analytics-react-native
does not pass through anyconfig
options to it'sSovranStorage
class which makescreateStore
function calls. Except forwriteKey
that is which maps tostoreId
in theSovranStorage
class.Proposed Solution
createClient
export'sConfig
argument should include an option forstorePersistor
. Which will match thePersistor
interface of@segment/sovran-react-native
SovranStorage
class needs either a second argument forstorePersistor
or it needs to have it ownConfig
interface for the argument to support astoreId
andstorePersistor
options.createStore
calls inSovranStorage
class must passpersistor
property in thepersist
object option.The text was updated successfully, but these errors were encountered: