Skip to content
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

Fix Suspense boundary indefinitely shown when fetchMore returns error #12110

Merged
merged 7 commits into from
Nov 7, 2024

Conversation

jerelmiller
Copy link
Member

Fixes #12103

Fixes an issue where the Suspsense boundary would be shown indefinitely when fetchMore returned from useSuspenseQuery is called and an error is returned.

When using fetchMore, the handleNext function inside InternalQueryReference was never called so there was no handler to resolve the promise thrown to the Suspense boundary. This small fix ensures that reject is called in .catch so that the promise does not get stuck in pending.

@svc-apollo-docs
Copy link

svc-apollo-docs commented Nov 4, 2024

✅ Docs Preview Ready

No new or changed pages found.

Copy link

changeset-bot bot commented Nov 4, 2024

🦋 Changeset detected

Latest commit: c4393ac

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

This PR includes changesets to release 1 package
Name Type
@apollo/client 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

@jerelmiller jerelmiller requested a review from phryneas November 4, 2024 22:46
Copy link

pkg-pr-new bot commented Nov 4, 2024

npm i https://pkg.pr.new/@apollo/client@12110

commit: 33fce79

Copy link
Contributor

github-actions bot commented Nov 4, 2024

size-limit report 📦

Path Size
dist/apollo-client.min.cjs 39.32 KB (+0.04% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/main.cjs" 48 KB (+0.03% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/main.cjs" (production) 45.58 KB (+0.04% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/index.js" 34.4 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/index.js" (production) 32.29 KB (0%)
import { ApolloProvider } from "dist/react/index.js" 1.26 KB (0%)
import { ApolloProvider } from "dist/react/index.js" (production) 1.24 KB (0%)
import { useQuery } from "dist/react/index.js" 5.21 KB (0%)
import { useQuery } from "dist/react/index.js" (production) 4.29 KB (0%)
import { useLazyQuery } from "dist/react/index.js" 5.69 KB (0%)
import { useLazyQuery } from "dist/react/index.js" (production) 4.77 KB (0%)
import { useMutation } from "dist/react/index.js" 3.62 KB (0%)
import { useMutation } from "dist/react/index.js" (production) 2.84 KB (0%)
import { useSubscription } from "dist/react/index.js" 4.42 KB (0%)
import { useSubscription } from "dist/react/index.js" (production) 3.48 KB (0%)
import { useSuspenseQuery } from "dist/react/index.js" 5.51 KB (+0.33% 🔺)
import { useSuspenseQuery } from "dist/react/index.js" (production) 4.17 KB (+0.36% 🔺)
import { useBackgroundQuery } from "dist/react/index.js" 5.01 KB (+0.34% 🔺)
import { useBackgroundQuery } from "dist/react/index.js" (production) 3.66 KB (+0.46% 🔺)
import { useLoadableQuery } from "dist/react/index.js" 5.09 KB (+0.35% 🔺)
import { useLoadableQuery } from "dist/react/index.js" (production) 3.73 KB (+0.43% 🔺)
import { useReadQuery } from "dist/react/index.js" 3.41 KB (+0.58% 🔺)
import { useReadQuery } from "dist/react/index.js" (production) 3.35 KB (+0.62% 🔺)
import { useFragment } from "dist/react/index.js" 2.28 KB (0%)
import { useFragment } from "dist/react/index.js" (production) 2.23 KB (0%)

Copy link
Member

@phryneas phryneas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me :)

@github-actions github-actions bot added the auto-cleanup 🤖 label Nov 7, 2024
@jerelmiller jerelmiller merged commit a3f95c6 into main Nov 7, 2024
32 of 36 checks passed
@jerelmiller jerelmiller deleted the jerel/fix-usq-fetchmore-error branch November 7, 2024 16:43
@github-actions github-actions bot mentioned this pull request Nov 7, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Promise thrown by useSuspenseQuery gets stuck "pending" forever when fetchMore request fails
3 participants