fix: error handling and loading states in with-apollo-and-redux example#91457
Conversation
|
Allow CI Workflow Run
Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer |
| await apolloClient.query({ | ||
| query: ALL_POSTS_QUERY, | ||
| variables: allPostsQueryVars, | ||
| }); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Yes. I asked them about it, they'll look into it. 🙏
There was a problem hiding this comment.
Ok, so I think, examples/with-apollo-and-redux/components/PostList.js is a good change, but not this one, nor the one below, subject to the API being fixed - let's wait a bit for an answer from Prisma Labs.
There was a problem hiding this comment.
@icyJoseph Any update from Prisma Labs? Is it possible tag someone in this PR?
There was a problem hiding this comment.
No updates yes, they have it on their radar though.
There was a problem hiding this comment.
- Removed try...catch blocks
Analysis: The demo backend (nextjs-graphql-with-prisma-simple-foo.vercel.app) returns HTTP 500 because its DB table may no longer exists — the database was never migrated or has been wiped. The GraphQL server itself is running, but any query that touches the database fails.
Note: with this change build (npm run dev) will be failed in runtime
There was a problem hiding this comment.
Any update from Prisma Labs? BTW I don't think so they managing those repos now
|
On its current state, this will show the error path right? Rather than crashing out. |
|
Ah there's one more thing blocking this merge. Not that, it'll work anyway, because the DB upstream is still down. We require verified commit signatures. There's a couple of unsigned commits: |
…raphql and lodash dependencies
8ee51bc to
bcd2666
Compare
Please check @icyJoseph |
|
Btw, sorry this took so long, I am a bit surprised we didn't get any resolution on the upstream DB. |
Tests PassedCommit: 12e70b2 |
Stats skippedCommit: 12e70b2 |
|
There's a minor lint issue: |
|
Nice, just to be orderly, can you update the PR description with what's actually been done? |
I have updated it @icyJoseph |

For Contributors
Fixing a bug
examples/change onlySummary
PostListdestructureddatabefore checkingloading/error, so the component threw whendatawasundefined(e.g., on the initial fetch or after a query error) instead of showing the loading/error UI.error/loading/!dataguard clauses above thedatadestructuring andloadMorePostsdefinition, and add a!datacheck so the component never accesses properties on an undefined value.graphql(14.5.8→16.13.1) andlodash(4.17.20→4.17.23) in the example'spackage.jsonto pick up fixes in dependencies the example relies on.Note:
Initially this PR suppose to target upstream DB issue