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

mobx-persist-store: minified bundle issue with <Class>.name usage #11

Open
sebastianjung opened this issue Apr 28, 2023 · 2 comments
Open

Comments

@sebastianjung
Copy link

sebastianjung commented Apr 28, 2023

Describe the bug
When using the approach shown in this example, where <Class>.name is being used as the name option, the minified bundle is giving warnings. Additionally, the app behaviour is impacted as hydration does not work as expected in some cases and state is lost.

To Reproduce
Steps to reproduce the behavior:

  1. Follow the approach in the example and use <Class>.name as the name for the name option.
  2. Generate a dev build: eas build --platform ios --profile development
  3. Generate a minified bundle: npx expo start --dev-client --minify
  4. Notice the warning in LogBox, and observe potential unexpected app behavior

Expected behavior
<Class>.name should be able to be used as a storage name without causing warnings or affecting app behavior.

Warning
mobx-persists-store: 'makePersistable' was called with the same storage name "t"

Environment

  • ios development: warning + behaviour
  • ios staging build ("developmentClient": false): behaviour only

Possible Solution
using static string values instead, like name: 'CounterStore'

@kanzitelli
Copy link
Member

Hi @sebastianjung! Thanks for reporting the issue.

It has been already happening to some people but never for me though. And the recommendation was to just give static string values as a store name as you suggested.

It would be great if you could create PR for this 👍

@sebastianjung
Copy link
Author

@kanzitelli
I'm sorry i can't provide a PR at this time. At least the issue is mentioned here including a solution in case someone is stumbling across this.

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