We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
undefined
useLazyLoadQuery
usePaginationFragment
19.0.0-rc-66855b96-20241106
18.2.0
When using loadNext from the usePaginationFragment hook, connection fields are parsed as undefined - But in the network response exist correctly.
loadNext
connection
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 of first - the bug appears.
friends()
first
Error: friends(first: $friendsFirst)
friends(first: $friendsFirst)
Works: friends(first: 20)
friends(first: 20)
Retrieved from Server:
{ "id": "123", "friends": { "edges": [] } }
Returned from usePaginationFragment:
{ "id": "123", "friends": undefined }
Wrapper Query:
query HomeQuery($first: Int = 20, $cursor: Cursor, $where: WhereInput = {}, ...bunchOfArgs){ ...HomeFragment @arguments(first: $first, cursor: $cursor, where: $where, ...bunchOfArgs: $...bunchOfArgs) }
Fragment:
fragment HomeFragment on Query @argumentDefinitions( first: { type: "Int", defaultValue: 20 } cursor: { type: "Cursor" } where: { type: "WhereInput", defaultValue: {} } ...bunchOfArgsDefs ) @refetchable(queryName: "HomePaginationQuery") { objects(first: $first, after: $cursor, where: $where) @connection(key: "HomeConnection_objects", filters: ["where"]){ edges { node { id friends(first: 20 # Changing this to a variable causes the bug to appear){ edges { node { id } } } } } } }
The text was updated successfully, but these errors were encountered:
@KieranTH do you have the full response payload to share for the loadNext that parsed to undefined? Including
{ data: {}, errors: [] // (if any errors exist) }
Sorry, something went wrong.
@KieranTH do you have the full response payload to share for the loadNext that parsed to undefined? Including { data: {}, errors: [] // (if any errors exist) }
There are no errors in response by the backend.
The response looks something like this:
{ data: { objects: { edges: [ { node: { "id": "123", "friends": { "edges": [] } } } ] } } }
I've actually been able to narrow it down fully.
When a default value isn't given to the first variable IN THE WRAPPER QUERY, the bug appears.
BROKEN:
HomeQuery($first: Int = 20, $cursor: Cursor, $where: WhereInput = {}, $friendFrist: Int)
WORKING:
HomeQuery($first: Int = 20, $cursor: Cursor, $where: WhereInput = {}, $friendFirst: Int = 20)
Even though I have a default set in the Fragment Arguments:
{ friendFirst: {type: "Int", defaultValue: 20} }
Any ideas why this could cause such weird behaviour?
No branches or pull requests
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: