Skip to content

fix: null-safe infinite query pages access - #182

Merged
jswirbs merged 1 commit into
mainfrom
fix/infinite-query-pages-optional-chain
Aug 11, 2026
Merged

jswirbs merged 1 commit into
mainfrom
fix/infinite-query-pages-optional-chain

Conversation

@jswirbs

@jswirbs jswirbs commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Optional-chain data.pages in @soundxyz/graphql-react-query's useInfiniteQuery (firstPage, lastPage, orderedList reduce) so a malformed infinite-query cache entry no longer throws during render (TypeError: … evaluating 'w?.pages[0]').
  • Patch changeset for a 5.5.3 release.

Context

Seen in Vault RUM on /chats (Capacitor iOS): RQ v4 can leave a truthy non-{pages,pageParams} value in an Infinite key after hydrate + observer-less invalidateQueries/refetchQueries. The wrapper only optional-chained data, not pages, which took down the React tree via the top-level error boundary.

Test plan

  • Publish 5.5.3 via changeset release
  • Vault bumps to 5.5.3 and confirms the RUM fingerprint stops (or degrades to empty inbox rather than fatal crash)

Made with Cursor

Prevent render crashes when cache data is truthy but missing the
`{ pages, pageParams }` wrapper (e.g. RQ v4 hydrate + observer-less refetch).

Co-authored-by: Cursor <cursoragent@cursor.com>
@changeset-bot

changeset-bot Bot commented Aug 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a470fff

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@soundxyz/graphql-react-query Patch
@soundxyz/graphql-react-query-example-next Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jswirbs
jswirbs merged commit 0171c8a into main Aug 11, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant