Skip to content

Commit 4da7d2d

Browse files
voxtextrojanowski
authored andcommitted
fix: notifyOnNetworkStatusChange default to false (#61)
ApolloClient QueryManager mutates the watchQueryOptions passed in to watchQuery and makes this field false if it is undefined. This breaks the query caching mechanism because invalidateCachedObservableQuery is called with this mutated watchQueryOptions and so the cache key for options changes from "{}" to "{notifyOnNetworkStatusChange: false}" and the stale observableQuery is never removed from the cache. https://github.com/apollographql/apollo-client/blob/3510493a2398f79bf193ab7579bbda87081cffcc/packages/apollo-client/src/core/QueryManager.ts#L658 Closes #59
1 parent bef4b86 commit 4da7d2d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/useQuery.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export function useQuery<TData = any, TVariables = OperationVariables>(
6060

6161
// Watch options
6262
pollInterval,
63-
notifyOnNetworkStatusChange,
63+
notifyOnNetworkStatusChange = false,
6464

6565
// Apollo client options
6666
context,

0 commit comments

Comments
 (0)