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

Wrong state on initial page load with SSR enabled #75

Open
jeffjfreeman opened this issue Jul 29, 2023 · 13 comments
Open

Wrong state on initial page load with SSR enabled #75

jeffjfreeman opened this issue Jul 29, 2023 · 13 comments

Comments

@jeffjfreeman
Copy link

jeffjfreeman commented Jul 29, 2023

Hi,

When using this module with SSR enabled, the Vuetify components are rendered in the wrong state on the initial page load. When disabling SSR, they are rendered as expected.

I created an example here: https://stackblitz.com/edit/nuxt-vuetify-ssr?file=app.vue

When the container loads, you'll notice none of the v-chips are rendered in active state, even though the v-model ref indicates the v-chips at index 1 and 4 should be in active state. If you disable SSR in nuxt.config.ts and reload the container, you'll notice the v-chips at index 1 and 4 are rendered in active state as expected.

@userquin
Copy link
Member

userquin commented Jul 29, 2023

I guess you should use useState:
https://nuxt.com/docs/getting-started/state-management

@jeffjfreeman
Copy link
Author

I guess you should use useState: https://nuxt.com/docs/getting-started/state-management

Hi, thank you for the quick reply! I'm actually using pinia in my project and having this issue. I updated the Stackblitz to use useState and the issue remains there as well.

@userquin
Copy link
Member

Thats a problem with nuxt and pinia, once solved vuetify component should work, the state will be there unless vuetify components requires additional logic (I guess it should work, I will check your repro tmr)

Check this another ssr issue about theme:
#58

@userquin
Copy link
Member

userquin commented Jul 29, 2023

@jeffjfreeman
Copy link
Author

Thats a problem with nuxt and pinia, once solved vuetify component should work, the state will be there unless vuetify components requires additional logic (I guess it should work, I will check your repro tmr)

Check this another ssr issue about theme: #58

Unfortunately it's not specific to pinia. I have reproduced it with pinia, Vue ref, and Nuxt useState.

@userquin
Copy link
Member

There is something failing in VChipGroup, check this repro using pinia: https://stackblitz.com/edit/nuxt-vuetify-ssr-xrmfb1

The chips cannot be selected, I guess the docs and the logic are wrong since the composable group is using the item.id to find the entry.

It seems isSelected is always false:
imagen

@userquin
Copy link
Member

maybe you need to use a v-for with object notation

@jeffjfreeman
Copy link
Author

Thanks for looking into this. I'll try opening an issue in the vuetify repo. It is definitely related to SSR because when I disable SSR everything works as expected.

@userquin
Copy link
Member

Have you tried selecting the chips? There is no way with or without ssr

@jeffjfreeman
Copy link
Author

In my Stackblitz they can be selected: https://stackblitz.com/edit/nuxt-vuetify-ssr?file=nuxt.config.ts

@GreyXor
Copy link

GreyXor commented Aug 22, 2023

Thanks for looking into this. I'll try opening an issue in the vuetify repo. It is definitely related to SSR because when I disable SSR everything works as expected.

Hello, did you manage to fix/handle it?

@jeffjfreeman
Copy link
Author

Thanks for looking into this. I'll try opening an issue in the vuetify repo. It is definitely related to SSR because when I disable SSR everything works as expected.

Hello, did you manage to fix/handle it?

Not yet, I haven't tried posting in the vuetify repo.

@AasmundN
Copy link

AasmundN commented Nov 3, 2023

Hi, I have run into the same issue. Any updates?

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

4 participants