File tree Expand file tree Collapse file tree 2 files changed +4
-13
lines changed
packages/vue-query-nuxt/src/runtime Expand file tree Collapse file tree 2 files changed +4
-13
lines changed Original file line number Diff line number Diff line change 1- import type { DehydratedState , DehydrateOptions } from "@tanstack/vue-query"
1+ import type { DehydratedState } from "@tanstack/vue-query"
22import { QueryClient , VueQueryPlugin , dehydrate , hydrate } from "@tanstack/vue-query"
3- import { getVueQueryOptions , dehydrateOptionKeys } from "./utils"
3+ import { getVueQueryOptions } from "./utils"
44import { pluginHook } from "#build/internal.vue-query-plugin-hook"
55import { defineNuxtPlugin , useRuntimeConfig , useState } from "#imports"
66
@@ -16,15 +16,7 @@ export default defineNuxtPlugin((nuxt) => {
1616
1717 if ( import . meta. server ) {
1818 nuxt . hooks . hook ( "app:rendered" , ( ) => {
19- vueQueryState . value = dehydrate ( queryClient , dehydrateOptionKeys . reduce < DehydrateOptions > ( ( newDehydrateOptions , key ) => {
20- if ( dehydrateOptions [ key ] !== undefined ) {
21- // https://stackoverflow.com/questions/64408632/typescript-inconsistent-check-for-undefined-why-do-i-need-an-exclamation-poin
22- // https://stackoverflow.com/questions/60077761/typescript-null-check-doesnt-work-inside-array-map-function/60077855#60077855
23- const narrowedValue = dehydrateOptions [ key ]
24- newDehydrateOptions [ key ] = ( ) => narrowedValue
25- }
26- return newDehydrateOptions
27- } , { } ) )
19+ vueQueryState . value = dehydrate ( queryClient , dehydrateOptions )
2820 } )
2921 }
3022
Original file line number Diff line number Diff line change @@ -15,13 +15,12 @@ const composables = [
1515] as const
1616
1717type VueQueryComposables = typeof composables
18- export const dehydrateOptionKeys = [ 'shouldDehydrateMutation' , 'shouldDehydrateQuery' , 'shouldRedactErrors' ] as Array < keyof DehydrateOptions > ;
1918export interface ModuleOptions {
2019 stateKey : string
2120 autoImports : VueQueryComposables | false
2221 queryClientOptions : QueryClientConfig | undefined
2322 vueQueryPluginOptions : VueQueryPluginOptions ,
24- dehydrateOptions : { [ P in typeof dehydrateOptionKeys [ number ] ] ?: boolean }
23+ dehydrateOptions : DehydrateOptions
2524}
2625
2726export const defaults : ModuleOptions = {
You can’t perform that action at this time.
0 commit comments