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

[Bug] SSR data not saved in store when using nuxt fetch hook #82

Open
ghost opened this issue Jul 12, 2020 · 3 comments
Open

[Bug] SSR data not saved in store when using nuxt fetch hook #82

ghost opened this issue Jul 12, 2020 · 3 comments

Comments

@ghost
Copy link

ghost commented Jul 12, 2020

Hello !

I ran into an issue while using this library.
I am using version 2.3.5.

When using nuxt fetch hook, and dispatching an action in the store, the data stored in the state vanishes once the page is loaded.
However, when using the asyncData hook allows you to have your component data reflecting the ssr fetched state.
But if in that same hook you only call the action (i.e. don't return anything), the problem is the same as with fetch.

I have created a reproduction repo there : https://github.com/Ghalnas/vuex-class-component-test

Thanks in advance !

@marijngiesen
Copy link

I'm having the same issue. The store doesn't seem to get hydrated with SSR data.

@navFooh
Copy link

navFooh commented May 13, 2021

Here as well. I'm using the fetch() method of a layout to call an async function on the store for retrieving data. This works well on the server-side, the page is being served with the right data.

However, after a split second, the store is initialized on the client side and the data disappears.

@aurror
Copy link

aurror commented Apr 28, 2022

Hey, same here.

I created a reproduction scenario, showing that it works with asyncData, but not with fetch. Using fetch, the warning "Cannot stringify a function" appears several times, and the site is broken.

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

3 participants