Stable Exome ID?
Hi. I'm trying to save a store state into localStorage, and trying to get a unique key.
I'm noticing that getId is most likely getting the .name from the class/constructor ?
dev:
production:
this makes the key differ after each build, because for the same store i've had
exome-i-storeexome-s-storeexome-b-storeetc...
am I assuming correctly? would i just need to skip get/setID() and use my own set of strings in some map? :)
thanks ❤️ (my favorite store lib)
PS: Typo :)
Hey, glad you like it!
The problem is that minifiers rename class identifiers. There are multiple ways to solve this:
- use
registerLoadable, then minifiers preserve names for registered stores; - set minifier to explicitly not minify identifiers you want;
- roll your own name map solution.
The 1st one should do the trick tho, that is what I usually use.
Thanks for pointing out typo, fixed it 👍
Hey :) I actually use registerLoadable :/ Does it has to be called before initializing a store instance?
For now I went with 3)
Interesting, do you mind sharing some minimal reproduction of it in some repo, codesandbox, stackblitz etc? Very interested in figuring out what's wrong here.
Sorry, no time for this repro yet :) But I haven't forgotten