Skip to content

Commit

Permalink
add missing effect deps for keyMap prop (#2561)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasheyenbrock authored Jul 11, 2022
1 parent 54654c0 commit 08346cb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/wild-wasps-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphiql/react': patch
---

Add missing effect dependencies to make sure editors are recreated when changing the `keyMap` prop
2 changes: 1 addition & 1 deletion packages/graphiql-react/src/editor/header-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export function useHeaderEditor({
return () => {
isActive = false;
};
}, [editorTheme, initialHeaders, readOnly, setHeaderEditor]);
}, [editorTheme, initialHeaders, keyMap, readOnly, setHeaderEditor]);

useChangeHandler(
headerEditor,
Expand Down
2 changes: 1 addition & 1 deletion packages/graphiql-react/src/editor/query-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export function useQueryEditor({
return () => {
isActive = false;
};
}, [editorTheme, initialQuery, readOnly, setQueryEditor]);
}, [editorTheme, initialQuery, keyMap, readOnly, setQueryEditor]);

/**
* We don't use the generic `useChangeHandler` hook here because we want to
Expand Down
2 changes: 1 addition & 1 deletion packages/graphiql-react/src/editor/variable-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export function useVariableEditor({
return () => {
isActive = false;
};
}, [editorTheme, initialVariables, readOnly, setVariableEditor]);
}, [editorTheme, initialVariables, keyMap, readOnly, setVariableEditor]);

useChangeHandler(
variableEditor,
Expand Down

0 comments on commit 08346cb

Please sign in to comment.