-
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
Connection Fields in Query are parsed to undefined
even though network response has data in those fields
#4875
Comments
@KieranTH do you have the full response payload to share for the loadNext that parsed to undefined? Including
|
There are no errors in response by the backend. The response looks something like this:
I've actually been able to narrow it down fully. When a default value isn't given to the BROKEN:
WORKING:
Even though I have a default set in the Fragment Arguments:
Any ideas why this could cause such weird behaviour? |
Interesting. Thanks for the report. So, if I understand correctly, the bug triggers when:
If all these things are true, you end up with I'm a little confused by the inclusion of Cache keys in the store are computed based on a field's name as well as a serialized form of the variables passed to that field. I suspect there's some disagreement between one or more of:
Perhaps somehow this combination of variables/defaults triggers a bug where they end up computing different cache keys? A snapshot of what's in the store before/after you issue the pagination query might help us understand what's gone wrong here. The next step here would be to create a reproduction of the issue as a test. Probably following the examples given here: https://github.com/facebook/relay/blob/main/packages/react-relay/relay-hooks/__tests__/usePaginationFragment-test.js |
Hooks used
useLazyLoadQuery
usePaginationFragment
Versions
19.0.0-rc-66855b96-20241106
18.2.0
Issue Description
When using
loadNext
from theusePaginationFragment
hook,connection
fields are parsed asundefined
- But in the network response exist correctly.Any data fetched initially is correctly structured via the Server response - this only happens with PAGINATED data.
This seems to be a regression after updating to the latest version of Relay. This setup was working previously.
I've been able to narrow down one of the triggers for it.
If i have a connection like
friends()
, if i add a VARIABLE offirst
- the bug appears.Error:
friends(first: $friendsFirst)
Works:
friends(first: 20)
Example of Data
Retrieved from Server:
Returned from
usePaginationFragment
:Example of Query
Wrapper Query:
Fragment:
The text was updated successfully, but these errors were encountered: