vuetifyjs / nuxt-module

Zero-config Nuxt Module for Vuetify
https://nuxt.vuetifyjs.com/
MIT License
226 stars 22 forks source link

Hybrid rendering: Cannot destructure property 'firstRequest' of 'state.value' as it is undefined #169

Closed kingyue737 closed 10 months ago

kingyue737 commented 11 months ago

Reproduction: https://stackblitz.com/edit/github-fi3r47-xug7re

The reproduction project is SSR but one of the routes is set with { ssr: false }. This error occurs when I navigate to this route via address bar.

Step:

  1. Open the repro link
  2. Append /bug in webcontainer address bar after the dev server started
  3. You will see 500 Cannot destructure property 'firstRequest' of 'state.value' as it is undefined.
userquin commented 11 months ago

@kingyue737 I can protect the code against the error, I have no idea what's happening since we can't register anything, check vuetify-client-hints.client.ts

imagen

userquin commented 10 months ago

@kingyue737 I guess I've found the way to hack it via Nitro plugin detecting non SSR page request and sending server-timing http headers to the client, rn the new /no-ssr page in the playground works on page refresh, I need to expose the configuration to the Nitro Plugin and finish some logic in the client to restore the theme.

Check last commit in the draft PR:

imagen

userquin commented 10 months ago

@kingyue737 added nitro plugin and updated SSR client hints plugin logic to restore theme-color, working fine.

If you want to test it, you can fork this repo and checkout the PR branch, instructions in the PR to run the playground.

color-scheme log extracted from server headers:

imagen

userquin commented 10 months ago

@kingyue737 should be fixed in v0.9.1, the fix didn't require a nitro plugin, the data can be configured in the client plugin