Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stable Exome ID? #24

Open
kristian-nst opened this issue Feb 15, 2025 · 4 comments
Open

Stable Exome ID? #24

kristian-nst opened this issue Feb 15, 2025 · 4 comments

Comments

@kristian-nst
Copy link

kristian-nst commented Feb 15, 2025

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:
Image

production:
Image

this makes the key differ after each build, because for the same store i've had

  • exome-i-store
  • exome-s-store
  • exome-b-store
    etc...

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 :)

Image

@Marcisbee
Copy link
Owner

Hey, glad you like it!

The problem is that minifiers rename class identifiers.
There are multiple ways to solve this:

  1. use registerLoadable, then minifiers preserve names for registered stores;
  2. set minifier to explicitly not minify identifiers you want;
  3. 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 👍

@kristian-nst
Copy link
Author

Hey :) I actually use registerLoadable :/ Does it has to be called before initializing a store instance?
For now I went with 3)

@Marcisbee
Copy link
Owner

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.

@kristian-nst
Copy link
Author

Sorry, no time for this repro yet :) But I haven't forgotten

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants