relay icon indicating copy to clipboard operation
relay copied to clipboard

Fix edge case issue around unsubscribing live queries

Open XiNiHa opened this issue 1 year ago • 4 comments

This only happens when...

  • A live query is passed to useLazyLoadQueryNode()
  • The initial fetch doesn't suspend
  • Two components subscribe to the same query with the same operation descriptor
  • The first subscribed component gets unmounted first

The fix is pretty simple though 😋

XiNiHa avatar Dec 12 '24 19:12 XiNiHa

@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?

https://github.com/facebook/relay/blob/4130d410ae1481b99ece8798d85d79e70557332e/packages/relay-runtime/util/RelayFeatureFlags.js#L16

captbaritone avatar Jan 23 '25 22:01 captbaritone

@XiNiHa Curious if you'll be able to add a flag here.

captbaritone avatar Feb 05 '25 04:02 captbaritone

Oops, missed the notification 😅 Will make it done today

XiNiHa avatar Feb 05 '25 04:02 XiNiHa

The test started to pass even without the fix 🤔 let me figure out what's happening...

XiNiHa avatar Feb 05 '25 05:02 XiNiHa

@XiNiHa Any progress here?

captbaritone avatar May 01 '25 20:05 captbaritone

I haven't looked into this for a while. Maybe we could just close the PR since it wasn't possible to reproduce the issue after rebasing....

XiNiHa avatar May 02 '25 16:05 XiNiHa