We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bea16ac commit e794b81Copy full SHA for e794b81
core/use-swr.ts
@@ -164,6 +164,7 @@ export const useSWRHandler = <Data = any, Error = any>(
164
// unnecessary re-renders, we keep the previous snapshot and use deep
165
// comparison to check if we need to return a new one.
166
let memorizedSnapshot = getSelectedCache(getCache())
167
+ const memorizedInitialSnapshot = getSelectedCache(getInitialCache())
168
169
return [
170
() => {
@@ -172,7 +173,7 @@ export const useSWRHandler = <Data = any, Error = any>(
172
173
? memorizedSnapshot
174
: (memorizedSnapshot = newSnapshot)
175
},
- () => getSelectedCache(getInitialCache())
176
+ () => memorizedInitialSnapshot
177
]
178
// eslint-disable-next-line react-hooks/exhaustive-deps
179
}, [cache, key])
0 commit comments