-
Notifications
You must be signed in to change notification settings - Fork 30.7k
fix(with-apollo-and-redux): resolve install failure and handle upstream API errors #91457
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
base: canary
Are you sure you want to change the base?
Changes from all commits
9f05e60
7e3ffcb
84e490a
09cc99a
1a116f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,10 +16,15 @@ const ApolloPage = () => ( | |
| export async function getStaticProps() { | ||
| const apolloClient = initializeApollo(); | ||
|
|
||
| await apolloClient.query({ | ||
| query: ALL_POSTS_QUERY, | ||
| variables: allPostsQueryVars, | ||
| }); | ||
| try { | ||
| await apolloClient.query({ | ||
| query: ALL_POSTS_QUERY, | ||
| variables: allPostsQueryVars, | ||
| }); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here you'd want to error at build time, not hide the error or hope to catch it during rendering. You might end up shipping bad UI
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It call https://nextjs-graphql-with-prisma-simple-foo.vercel.app/api endpoint which is empty, hence the example project can't be build at all.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mm but that's another issue then, that project should serve data... I don't have time to look into at the moment - but I'll try later
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://nextjs-graphql-with-prisma-simple-foo.vercel.app/api I found the origin of the url project: https://github.com/prisma-labs/nextjs-graphql-api-examples
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. I asked them about it, they'll look into it. 🙏 |
||
| } catch (_) { | ||
| // If the API is unavailable, fall back to an empty initial state. | ||
| // The PostList component will surface the error via its own useQuery call. | ||
| } | ||
|
|
||
| return { | ||
| props: { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.