Skip to content

Commit

Permalink
fix issue with next where staleWhileRevalidate would loop (#1895)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock authored Aug 27, 2021
1 parent dbb52bd commit 3eaed7e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/six-walls-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'next-urql': patch
---

Fix issue where the `renderToString` pass would keep looping due to reexecuting operations on the server
5 changes: 4 additions & 1 deletion packages/next-urql/src/with-urql-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ export function withUrqlClient(
ssr = ssrExchange({
initialState: urqlServerState,
isClient: true,
staleWhileRevalidate: options!.staleWhileRevalidate,
staleWhileRevalidate:
typeof window !== 'undefined'
? options!.staleWhileRevalidate
: undefined,
});
} else if (!version) {
ssr.restoreData(urqlServerState);
Expand Down

0 comments on commit 3eaed7e

Please sign in to comment.