fix(app): do not call handler twice on navigation (#280)

This commit is contained in:
Daniel Roe 2021-06-30 10:22:16 +01:00 committed by GitHub
parent 86af8457a9
commit 3829a21729
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,4 @@
import { getCurrentInstance, onBeforeMount, onUnmounted, Ref, ref, unref, UnwrapRef, watch } from 'vue'
import { getCurrentInstance, onBeforeMount, onUnmounted, Ref, ref, unref, UnwrapRef } from 'vue'
import { Nuxt, useNuxt } from '@nuxt/app'
import { NuxtComponentPendingPromises } from './component'
@ -85,9 +85,6 @@ export function useAsyncData (defaults?: AsyncDataOptions) {
// Client side
if (process.client) {
// Watch handler
watch(handler.bind(null, nuxt), fetch)
// 1. Hydration (server: true): no fetch
if (nuxt.isHydrating && fetchOnServer) {
state.pending.value = false