You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: skip empty non-list queries during fetchAll pagination (#1395)
## Summary
- extend the regression test covering a token query whose only field
uses `@fetchAll` so it also verifies no extra non-list request is issued
- ensure paginated results create parent containers before setting list
data
- skip executing non-list GraphQL requests when no fields remain after
removing `@fetchAll`
## Testing
- bun test sdk/thegraph/src/utils/pagination.test.ts *(fails: missing
dependency `gql.tada` because packages cannot be downloaded in the
execution environment)*
------
https://chatgpt.com/codex/tasks/task_b_6904799dd93883208eb61e4f90b5c5ab
## Summary by Sourcery
Prevent empty non-list queries during @fetchall pagination by checking
for executable fields and extend tests to cover queries with only
fetchAll lists
Bug Fixes:
- Skip executing non-list GraphQL queries when no executable fields
remain after removing @fetchall
Enhancements:
- Add countExecutableFields helper to detect and skip empty queries
- Refactor createNonListQuery to prune fields without selections on
leave
Tests:
- Add test to verify queries with only @fetchall list fields skip
non-list requests and return paged data
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Skips executing non-list GraphQL requests when only @fetchall list
fields remain, with AST pruning and a regression test to verify
behavior.
>
> - **Pagination utils**:
> - `createNonListQuery(...)`: removes list fields and prunes empty
selection sets; always returns a filtered document.
> - `countExecutableFields(...)`: new helper to detect empty documents;
used to skip non-list requests when no executable fields remain.
> - Minor: import `FieldNode` for leave-visitor pruning.
> - **Tests**:
> - Add regression test ensuring a query with only `@fetchAll` list
fields returns data and does not issue an extra non-list request.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
95573b2. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
0 commit comments