Skip to content

Commit

Permalink
fix(core): Add missing teardown handling to ssrExchange (#3386)
Browse files Browse the repository at this point in the history
  • Loading branch information
kitten committed Sep 18, 2023
1 parent 307327f commit 643f426
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/old-swans-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@urql/core': patch
---

Fix missing `teardown` operation handling in the `ssrExchange`. This could lead to duplicate network operations being executed.
2 changes: 2 additions & 0 deletions packages/core/src/exchanges/ssr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ export const ssrExchange = (params: SSRExchangeParams = {}): SSRExchange => {
ops$,
filter(
operation =>
operation.kind === 'teardown' ||
!data[operation.key] ||
!!data[operation.key]!.hasNext ||
operation.context.requestPolicy === 'network-only'
Expand All @@ -236,6 +237,7 @@ export const ssrExchange = (params: SSRExchangeParams = {}): SSRExchange => {
ops$,
filter(
operation =>
operation.kind !== 'teardown' &&
!!data[operation.key] &&
operation.context.requestPolicy !== 'network-only'
),
Expand Down

0 comments on commit 643f426

Please sign in to comment.