graphql-js
graphql-js copied to clipboard
fix(jsutils): use optional chaining to prevent crash in browser
Context
We use contentful/live-preview. The library has graphql-js as a dependency.
Problem
If the DOM has an element with id="process" eg. <div id="process"></div> than the current implementation of utils/instanceOf would fail.
Current implementation:
globalThis.process != null && globalThis.process.env.NODE_ENV === 'production'
with this implementation globalThis.process will return the DOM element:
Because globalThis.process is true, the condition globalThis.process.env.NODE_ENV === 'production' gets executed and will result with an javascript error:
- :x: - login: @michaelbirchler / name: Michael Birchler . The commit (9d261946976f51fbf8ad7982cb9e5dd6e2cb7acf) is not authorized under a signed CLA. Please click here to be authorized. For further assistance with EasyCLA, please submit a support request ticket.
Deploy Preview for compassionate-pike-271cb3 ready!
| Name | Link |
|---|---|
| Latest commit | 9d261946976f51fbf8ad7982cb9e5dd6e2cb7acf |
| Latest deploy log | https://app.netlify.com/sites/compassionate-pike-271cb3/deploys/65c20699135707000772b88c |
| Deploy Preview | https://deploy-preview-4017--compassionate-pike-271cb3.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.