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"
2
2
import { QueryClient , VueQueryPlugin , dehydrate , hydrate } from "@tanstack/vue-query"
3
- import { getVueQueryOptions , dehydrateOptionKeys } from "./utils"
3
+ import { getVueQueryOptions } from "./utils"
4
4
import { pluginHook } from "#build/internal.vue-query-plugin-hook"
5
5
import { defineNuxtPlugin , useRuntimeConfig , useState } from "#imports"
6
6
@@ -16,15 +16,7 @@ export default defineNuxtPlugin((nuxt) => {
16
16
17
17
if ( import . meta. server ) {
18
18
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 )
28
20
} )
29
21
}
30
22
Original file line number Diff line number Diff line change @@ -15,13 +15,12 @@ const composables = [
15
15
] as const
16
16
17
17
type VueQueryComposables = typeof composables
18
- export const dehydrateOptionKeys = [ 'shouldDehydrateMutation' , 'shouldDehydrateQuery' , 'shouldRedactErrors' ] as Array < keyof DehydrateOptions > ;
19
18
export interface ModuleOptions {
20
19
stateKey : string
21
20
autoImports : VueQueryComposables | false
22
21
queryClientOptions : QueryClientConfig | undefined
23
22
vueQueryPluginOptions : VueQueryPluginOptions ,
24
- dehydrateOptions : { [ P in typeof dehydrateOptionKeys [ number ] ] ?: boolean }
23
+ dehydrateOptions : DehydrateOptions
25
24
}
26
25
27
26
export const defaults : ModuleOptions = {
You can’t perform that action at this time.
0 commit comments