fix: initialize currentDocument early, fix #1325

This commit is contained in:
Guillaume Chau
2023-05-16 15:05:39 +02:00
parent b2f773c6f7
commit 2de65e4822
@@ -204,7 +204,8 @@ export function useQueryImpl<
function start () {
if (
started || !isEnabled.value ||
(isServer && currentOptions.value?.prefetch === false)
(isServer && currentOptions.value?.prefetch === false) ||
!currentDocument
) {
if (firstResolve) firstResolve()
return
@@ -413,6 +414,9 @@ export function useQueryImpl<
debouncedRestart()
}
// Applying document
let currentDocument: DocumentNode = documentRef.value
// Enabled state
const forceDisabled = ref(lazy)
@@ -435,12 +439,9 @@ export function useQueryImpl<
})
// Applying document
let currentDocument: DocumentNode
watch(documentRef, value => {
currentDocument = value
restart()
}, {
immediate: true,
})
// Applying variables