Skip to content
Discussion options

You must be logged in to vote

In Nuxt 3 with ISR and payload extraction, useNuxtApp().payload needs to preserve dehydrated state across navigation boundaries (stored in _payload.json).

Putting the dehydrated state into useNuxtApp().payload[payloadKey] inside your plugin is the correct approach for Nuxt 3.21+ payload extraction. To ensure smooth client hydration on both initial load and soft navigation:

import { VueQueryPlugin, QueryClient, hydrate, dehydrate } from '@tanstack/vue-query'
import type { DehydratedState } from '@tanstack/vue-query'

export default defineNuxtPlugin((nuxtApp) => {
  const queryClient = new QueryClient({
    defaultOptions: {
      queries: {
        staleTime: 1000 * 60 * 5, // 5 mins
      },

Replies: 2 comments 1 reply

This comment was marked as spam.

@TkDodo
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by lostgeek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants