-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
Description
In our Relay-based app we are using Relay resolvers for pure client state (available synchronously) and for REST API calls, while also fetching other parts of the query from a GraphQL server. While doing so, we are experiencing an issue with resolver data being seemingly disposed from the store by GC while still being in use after several extra queries are issued, and the resolver is not executed again. We weren't able to troubleshoot/debug the issue further, but the symptoms are as follows:
- Relay logs a warning about being unable to read data for a fragment (actual fragment in question isn't fully deterministic and also changes when you move components around):
Warning: Relay: Expected to have been able to read non-null data for fragment `...' declared in `useFragment()', since fragment reference was non-null. Make sure that that `useFragment()`'s parent isn't holding on to and/or passing a fragment reference for data that has been deleted. - App crashes with an error immediately, since
useFragmentreturnsundefinedafter the warning above and it cannot be destructured. - Increasing
gcReleaseBufferSizevalue makes it so that the error takes longer to occur and is less deterministic, but as far as we could tell, it never goes away fully.
While our app is somewhat complex and also cannot be shared publicly, I have managed to create a minimal repro with the same query pattern:
alina-zaieva/relay-gc-repro
The repro repo above also has some extra details on the setup and the error.
sjwilczynski and raekulcaptbaritone and alloy