mobx-persist icon indicating copy to clipboard operation
mobx-persist copied to clipboard

Rehydrating a Map with integers as keys turns them into strings.

Open schumannd opened this issue 5 years ago • 1 comments

I can imagine this has to do with using react natives AsyncStorage, which only saves strings.

We should find a way to save the type of the key before saving them to async storage. Once saved there I think it is not possible to find out the type again.

Maybe this is an issue with all integers?

Easily reproducible by creating a @persist Map<number, whatever>, then saving something in it, rehydrating, and its key has changed from int to string.

schumannd avatar May 08 '19 08:05 schumannd

I have a similar issue:

@observable public Categories: Map<string, boolean>;

which is a <ObservableMap> becomes a <Proxy> and don't have the value after hydrating..

Emixam23 avatar Feb 13 '20 05:02 Emixam23