diff --git a/src/hooks/useApollo.tsx b/src/hooks/useApollo.tsx index cd08ba7b9..a19f26e23 100644 --- a/src/hooks/useApollo.tsx +++ b/src/hooks/useApollo.tsx @@ -158,14 +158,14 @@ class FullResultCache extends ApolloCache { watch.callback(this.diff(watch)); }; + if (entry) { + log('GraphQL Cache', 'immediately fire watcher'); + watch.callback(this.diff(watch)); + } + if (name) { log('GraphQL Cache', 'store watcher'); this.watchers.set(name, this.watchers.get(name)?.concat(watcher) ?? []); - } - - if (entry && name) { - log('GraphQL Cache', 'immediately fire watcher'); - watch.callback(this.diff(watch)); return () => { const updatedWatchers = this.watchers.get(name)?.filter((it) => it !== watcher) ?? []; this.watchers.set(name, updatedWatchers);