Skip to content

Commit

Permalink
fix: should not depend on 'global' global variable (#2155) (#2156)
Browse files Browse the repository at this point in the history
  • Loading branch information
francisu authored Feb 14, 2022
1 parent dc60ba0 commit ae5ea77
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/selfish-lies-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'graphiql': patch
---

Fixed problem where 'global' variable is referenced when it might not be present (#2155)
4 changes: 3 additions & 1 deletion packages/graphiql/src/components/GraphiQL.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,9 @@ export class GraphiQL extends React.Component<GraphiQLProps, GraphiQLState> {
// Utility for keeping CodeMirror correctly sized.
this.codeMirrorSizer = new CodeMirrorSizer();

global.g = this;
if (global) {
global.g = this;
}
}
UNSAFE_componentWillMount() {
this.componentIsMounted = false;
Expand Down

2 comments on commit ae5ea77

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.