-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix edge case issue around unsubscribing live queries #4868
base: main
Are you sure you want to change the base?
Conversation
@@ -69,7 +67,7 @@ hook useLazyLoadQueryNode<TQuery: OperationType>({ | |||
fetchObservable, | |||
fetchPolicy, | |||
renderPolicy, | |||
{start: startFetch, complete: completeFetch, error: completeFetch}, | |||
undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you help me understand why these are safe to remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was for calling .unsubscribe()
when the component unmounts. However since the unsubscribe is now a no-op there's no point for keeping this anymore
}, | ||
}; | ||
observerStart(subscriptionWithConditionalCancelation); | ||
unsubscribe: () => {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do live queries still get unsubscribed through some other means?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it's managed by the .retain()
stuff and is also ensured with the test added (the .toThrow()
part)
0b4cf67
to
b7dc565
Compare
@XiNiHa I think I've been hesitant to merge this for fear that there are some edge cases I'm not aware of here and that it could break things when I roll it out. Would you be willing to add this change (fix) behind a feature flag?
|
@XiNiHa Curious if you'll be able to add a flag here. |
Oops, missed the notification 😅 Will make it done today |
b7dc565
to
2890ce1
Compare
2890ce1
to
3a012df
Compare
3a012df
to
2a9058d
Compare
The test started to pass even without the fix 🤔 let me figure out what's happening... |
This only happens when...
useLazyLoadQueryNode()
The fix is pretty simple though 😋