mirror of
https://github.com/vuejs/apollo.git
synced 2026-02-01 14:37:18 +00:00
fix: use onBeforeUnmount
This commit is contained in:
parent
2a9ca9f7fa
commit
9c4b6b09b7
@ -1,6 +1,6 @@
|
||||
import { DocumentNode } from 'graphql'
|
||||
import { MutationOptions, OperationVariables } from 'apollo-client'
|
||||
import { ref } from '@vue/composition-api'
|
||||
import { ref, onBeforeUnmount } from '@vue/composition-api'
|
||||
import { FetchResult } from 'apollo-link'
|
||||
import { useApolloClient } from './useApolloClient'
|
||||
import { ReactiveFunction } from './util/ReactiveFunction'
|
||||
@ -73,6 +73,10 @@ export function useMutation<
|
||||
}
|
||||
}
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
loading.value = false
|
||||
})
|
||||
|
||||
return {
|
||||
mutate,
|
||||
loading,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ref, Ref, isRef, computed, watch, onServerPrefetch, onUnmounted, getCurrentInstance } from '@vue/composition-api'
|
||||
import { ref, Ref, isRef, computed, watch, onServerPrefetch, getCurrentInstance, onBeforeUnmount } from '@vue/composition-api'
|
||||
import Vue from 'vue'
|
||||
import { DocumentNode } from 'graphql'
|
||||
import {
|
||||
@ -373,7 +373,7 @@ export function useQuery<
|
||||
})
|
||||
|
||||
// Teardown
|
||||
onUnmounted(() => {
|
||||
onBeforeUnmount(() => {
|
||||
stop()
|
||||
subscribeToMoreItems.length = 0
|
||||
})
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { DocumentNode } from 'graphql'
|
||||
import Vue from 'vue'
|
||||
import { Ref, ref, watch, isRef, onUnmounted, computed, getCurrentInstance } from '@vue/composition-api'
|
||||
import { Ref, ref, watch, isRef, computed, getCurrentInstance, onBeforeUnmount } from '@vue/composition-api'
|
||||
import { OperationVariables, SubscriptionOptions } from 'apollo-client'
|
||||
import { Observable, Subscription } from 'apollo-client/util/Observable'
|
||||
import { FetchResult } from 'apollo-link'
|
||||
@ -188,7 +188,7 @@ export function useSubscription <
|
||||
})
|
||||
|
||||
// Teardown
|
||||
onUnmounted(stop)
|
||||
onBeforeUnmount(stop)
|
||||
|
||||
return {
|
||||
result,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user