Changing the graphql query does not give a network error

This issue has been created since 2021-07-27.

Thank you very much for the free course, really good material!


In master branch 25-http.html

if you change the name to nam like in the video, it does not give a network error but still provide correct response for the pokemon name (ex: mew)

const pokemonQuery = `
        query PokemonInfo($name: String) {
          pokemon(name: $name) {
            id
            number
            name
            attacks {
              special {
                nam
                type
                damage
              }
            }
          }
        }`;

Why is that I am confused?

kentcdodds wrote this answer on 2021-07-27

In an effort to make this workshop work completely offline (and not rely on 3rd parties), we actually use a service worker to intercept all network requests and handle them ourselves in this file: https://github.com/kentcdodds/beginners-guide-to-react/blob/main/pokemon-api.js

It seems you've found a bug in our implementation (PRs welcome).

I made this change after the videos were created, so that's why you're seeing the difference.

kaushalyap wrote this answer on 2021-07-31

It seems you've found a bug in our implementation (PRs welcome).

I looked in to this, it seems pokemon-api.js do no care about the graphql query at all, it just get a object by name.

mswjs do not do data schema validation internally so the mockServiceWorker.js graphql error just do syntax validation.

I tried to include graphql-js using upkg to use graphql/validation in order to validate the graphql schema but facing an error

<script src="https://unpkg.com/graphql"></script>

Uncaught ReferenceError: exports is not defined
    at graphql:3

probably graphql-js is not supported through CDNs.

Writing custom graphql schema validation is tricky.

kentcdodds wrote this answer on 2021-07-31

Ah, I see. Yeah, that's a bit of a bummer. I'm afraid we'll probably just have to live with this :-/

kaushalyap wrote this answer on 2021-08-01

I'll close this now then.

More Details About Repo
Owner Name kentcdodds
Repo Name beginners-guide-to-react
Full Name kentcdodds/beginners-guide-to-react
Language HTML
Created Date 2020-01-27
Updated Date 2022-09-21
Star Count 635
Watcher Count 13
Fork Count 501
Issue Count 0

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
cvxopt was moved to an optional dependency but is still required 1 2021-10-01 2022-08-17
Support `mink run task://foo?bar=baz` 0 2021-03-28 2022-08-24
Laravel 9.x Compatibility 1 2022-02-12 2022-09-24
Blinky Hello World does not work for Apple Silicon devices 1 2022-09-14 2022-09-19
PKCS12/PFX full certificates chain 0 2019-12-05 2022-09-28
Page doesn't work 7 2021-05-31 2021-12-18
Theme doesn't install properly; breaks Mailspring 1 2021-03-31 2021-12-31
Add information about SCA requirement to How Do Site Columns Become Managed Properties - Thus Available for Search 9 2021-04-15 2022-09-27
Decision 2 - Main menu buttons don't navigate when clicked 0 2022-07-10 2022-09-02
mysql NumberFormatException 0 2021-07-27 2022-09-20
不能导出生成除了public模块以外的模块数据 1 2022-04-13 2022-09-20
Add exit survey to WC Pay welcome screen 0 2021-07-01 2022-09-19
Multiple inbound nodes error when visualising dense softmax 29 2017-06-09 2022-09-04
Link to hueman forum in _pre_base 0 2017-03-06 2021-12-28
Question: nav_menu_location not init with selecter.js, why? 0 2017-01-21 2022-08-11
How can I get "git diff --binary --patch commi1 commit2" to include fully binary patches for LFS binary files 1 2021-12-15 2022-09-13
PowerSGD is similiar efficient with torch.svd_lowrank 3 2022-05-12 2022-09-19
"-Xir-property-lazy-initialization" seems to be not supported 2 2021-02-12 2022-09-27
Multiple CSS files, how to handle 1 2022-01-15 2022-09-27
[Eaton][S3700DIN][0463:ffff] usbhid-ups: nut_libusb_get_interrupt: No such device (it may have been disconnected); nut_libusb_get_report: Input/Output Error 1 2022-03-27 2022-09-19
Helm chart broken when using Redis password with BYO-Redis 7 2022-07-22 2022-09-14
hasMany/hasOne do not check document access authorization on resolved documents 0 2021-08-27 2022-08-31
Faster build with SWC or Esbuild 3 2021-11-12 2022-08-17
Error installing marginalia.ERROR: Failed to build gem native extension 3 2020-03-07 2022-09-15
Reformatting /** */ comment introduces weird space 1 2022-06-23 2022-09-06
Abstract out Docker image name from pipeline/lib/pipeline.ml to environments 2 2021-04-26 2022-09-21
Provide versioned tags for this container image 0 2021-01-10 2022-08-23
Access key cannot be null failure with SSO configuration 0 2022-09-14 2022-09-29
Cannot read property 'registerPlugin' of undefined (using webpack) 8 2017-06-09 2022-08-18
Trap statement only cover errors thrown from the same enclosing script block, not the same scope 0 2022-05-25 2022-09-24
Link to https://visualstudio.com/ is not valid anymore 1 2022-06-15 2022-09-24
Arguments in the Arguments section won't match the YAML snippet 3 2022-03-08 2022-08-21
Error restarting zabbix agent after adding Postgresql 4 2020-11-01 2022-08-30
Bump ssri from 6.0.1 to 6.0.2 in /examples/FlashMessagePlayground 0 2021-04-20 2022-01-28
Merging forms app with poll app 1 2021-12-09 2022-09-26
Synced files seem as folders by android 12 file system 1 2022-02-24 2022-09-08
Unable to run programs using the modem component 3 2020-12-29 2022-08-09
zsh plugins added to the path, why do we need this? 3 2021-09-23 2022-09-27
`pub fn main() void { { return; } return; }` evades unreachable code error 1 2022-05-20 2022-09-22
Support more compare operators in partition filters. 6 2021-10-23 2022-09-14
README install assumes use of WordPress <5.6 and use of application-passwords plugin 0 2022-01-28 2022-09-19
Error building site with Doks theme 6 2022-07-12 2022-09-19
- (NSString *)base64EncodedStringWithWrapWidth:(NSUInteger)wrapWidth will crash in certain conditions 2 2013-01-07 2022-09-27
this.nuxt.build is not a function 5 2017-05-24 2022-09-26
请问kie推理模型可以集成到pdserving,用rpc请求预测结果吗? 1 2022-09-13 2022-09-29
关于yolo_loss官方文档的 stop_gradient=True 1 2021-11-06 2022-08-06
how can i Reproduce 1,500 TPS in substrate benchmark test with multi validator node 2 2021-10-11 2022-09-05
Refactor socket lock in asio_rpc_session to asio::strand 0 2021-12-31 2022-09-28
how do I use this? 2 2021-09-10 2022-01-15
Improve customizing OIDC UserInfo endpoint 0 2022-06-17 2022-09-23