Comments (9)
Oh! Nice! I didn't realize that API exists. Would you be interested in making a PR for that?
from react-suspense.
Hmmm... I thought @cesarcf had addressed this in https://github.com/kentcdodds/react-suspense/pull/37 🤔
from react-suspense.
I'm not sure it was a complete fix, because there are two places where the promise is being rejected, but only one was changed from Error
to String
.
Moreover, ErrorFallback
component relies on Error
object since it outputs error.message
and not just error
.
Anyway, this is a different issue, and my previous comment is more about checking the result from the API.
Currently the code checks response.errors
, but should check response.data.errors
:
if (response.data.errors) {
return Promise.reject(
new Error(response.data.errors.map(e => e.message).join('\n')),
)
}
from react-suspense.
I think I misunderstood the issue @cesarcf was talking about in #37 and that change should be reverted. Doing that now.
from react-suspense.
@all-contributors please add @intrueder for bugs
from react-suspense.
I've put up a pull request to add @intrueder! 🎉
from react-suspense.
I just realized, that response.errors
is probably there to handle server errors, and if pokemon name is misspelled then error will be handled by else
branch, that's why there is no check for response.data.errors
But... what is a server error then? I tried to simulate it by breaking a graphql request (some invalid variable: variables: {namez: name.toLowerCase()}
) and the response has no errors
field:
At the same time GraphiQL console works in a very different way, I can't see data.errors
field in the result:
from react-suspense.
Keep in mind that we don't actually have a real server in this workshop (so it works offline): https://github.com/kentcdodds/react-suspense/blob/c6a440d3b04b5ba6693423b6c8e65f5fd9c8dbaa/src/backend.js#L32
from react-suspense.
Haha 😄 Totally forgot about this. Thanks!
So, here is the problem:
https://github.com/kentcdodds/react-suspense/blob/c6a440d3b04b5ba6693423b6c8e65f5fd9c8dbaa/src/backend.js#L42
I believe it should be:
ctx.errors([
{
message: `Unsupported pokemon: "${req.variables.name}". Try "${randomName}"`,
},
])
from react-suspense.
Related Issues (19)
- Error: Failed to load parser '@typescript-eslint/parser' HOT 4
- Exercises' titles are not displayed on the dashboard HOT 15
- Server responses with status 400 for "fetch approaches" examples HOT 2
- ErrorBoundary unable to handle Errors throw in Async function HOT 9
- Does it make sense to create the resource eagerly? HOT 1
- Problem in exercise 2 HOT 1
- Issue on exercice 7 HOT 9
- Unable to start the application HOT 5
- Problem executing validation step in setup HOT 4
- Minor typo in toc sidebar HOT 1
- Problem with error boundary in exercise 2 HOT 1
- Error Boundary not working properly HOT 2
- Exercise 2: Derived state for pokemonResource based on pokemonName? HOT 1
- Error using node version 16 HOT 7
- Error for `node setup` on node v18 HOT 1
- Reset not working - Uncaught ReferenceError: process is not defined HOT 2
- Exercise 3.1: Delay doesn't work as expected with opacity transition HOT 2
- Simple Data-fetching exercise not being rendered. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-suspense.