Skip to content

Commit

Permalink
fix ReferenceError: window is not defined in Next.js (#3198)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaMachina authored May 28, 2023
1 parent c33dd29 commit e6cb639
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/light-cats-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'graphiql': patch
---

fix ReferenceError: window is not defined in Next.js
1 change: 1 addition & 0 deletions packages/graphiql/src/components/GraphiQL.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ export type GraphiQLInterfaceProps = WriteableEditorProps &
};

const modifier =
typeof window !== 'undefined' &&
window.navigator.platform.toLowerCase().indexOf('mac') === 0 ? (
<code className="graphiql-key">Cmd</code>
) : (
Expand Down

0 comments on commit e6cb639

Please sign in to comment.