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

Error while using useStore #25

Open
andvlad opened this issue Dec 27, 2022 · 4 comments
Open

Error while using useStore #25

andvlad opened this issue Dec 27, 2022 · 4 comments

Comments

@andvlad
Copy link
Contributor

andvlad commented Dec 27, 2022

Hello.

I'm using Preact + vite-plugin-ssr and useStore gives me an error:
TypeError: Cannot read properties of undefined (reading '__H')
So far, I haven't been able to figure out what the problem is. Maybe I'm doing something wrong.
Example

It would be great if anyone has any ideas
Thanks

@ai
Copy link
Member

ai commented Dec 27, 2022

How do you server JSON file with translations?

@andvlad
Copy link
Contributor Author

andvlad commented Dec 28, 2022

Actually I don't want to use JSON files for now. I want to use default translations in the component.
But createI18n.get is mandatory, so I just put there cross-fetch request which doesn't return anything, because I thought it would be leveraged only on locale changes. And I don't change locales for now.
I also tried to directly import JSON files with import().
But error still the same (I created some placeholder JSON files for this)

@ai
Copy link
Member

ai commented Dec 28, 2022

Sorry, have no idea. Code looks fine. Maybe some strange bug with Preact?

@andvlad
Copy link
Contributor Author

andvlad commented Dec 28, 2022

I copied the code from useStore to the local hook and it started working. (I updated example)
Quite strange thing

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