Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
useSubscription: keep subscription Concast alive if new in-flight sub…
…scription subscribes at the same time last in-flight subscription unsubscribes (#10718) * Nullify Concast.sub more carefully with rollback in event of last observer unsubscribe immediately followed by new observer subscribe * Preserve concast.promise when deferring subscription unsubscribing * add Concast test for added unsub/promise deferral * Regenerate internal promise within Concast when rolling back deferred unsubscribe instead of delaying resolve/reject * Improve reject message in new Concast test relating to concast.promise status * Remove unneeded callback parameter from Concast.deferredUnsubscribe * Avoid renewing Concast subscription and internalPromise if subscription is already closed at time of unsubscription * add Concast test for added unsub/promise deferral * Improve reject message in new Concast test relating to concast.promise status * Always unsubscribe sub in deferredUnsubscribe if Concast handled an error * Add changeset * add Concast test for added unsub/promise deferral * Improve reject message in new Concast test relating to concast.promise status * Shift scope of Concast unsubscription fix from Concast to useSubscription * Slight revision of changeset * Remove leftover Concast test * Use let variable instead of second subscription to carryout deferral of useSubscription unsub --------- Co-authored-by: Jonathan <jonathan.sun@mujin.co.jp> Co-authored-by: Lenz Weber-Tronic <lorenz.weber-tronic@apollographql.com>
- Loading branch information
1 parent
a550366
commit 577c68b
Showing
3 changed files
with
101 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@apollo/client": patch | ||
--- | ||
|
||
Delay Concast subscription teardown slightly in `useSubscription` to prevent unexpected Concast teardown when one `useSubscription` hook tears down its in-flight Concast subscription immediately followed by another `useSubscription` hook reusing and subscribing to that same Concast |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters