Skip to content

Commit

Permalink
minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Sep 12, 2024
1 parent a3a670a commit 892bf80
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/vike-vue-query/integration/onAfterRenderHtml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@ import { dehydrate } from '@tanstack/vue-query'
import type { OnAfterRenderHtmlSync } from 'vike-vue/types'

const onAfterRenderHtml: OnAfterRenderHtmlSync = (pageContext): ReturnType<OnAfterRenderHtmlSync> => {
dehydrateVueQuery(pageContext)
}

type PageContext = Parameters<typeof onAfterRenderHtml>[0]
function dehydrateVueQuery(pageContext: PageContext) {
pageContext._vueQueryInitialState = dehydrate(pageContext.queryClient!)
}

0 comments on commit 892bf80

Please sign in to comment.