Skip to content

Commit

Permalink
fix: fix tab content getting replaced on changeTab (#3194)
Browse files Browse the repository at this point in the history
Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru>
Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com>
  • Loading branch information
3 people committed May 27, 2023
1 parent 4c3a08b commit 911cf3e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/afraid-zoos-fix.md
@@ -0,0 +1,5 @@
---
'@graphiql/react': patch
---

fix tab content getting replaced on `changeTab`
4 changes: 2 additions & 2 deletions packages/graphiql-react/src/editor/context.tsx
Expand Up @@ -391,7 +391,7 @@ export function EditorContextProvider(props: EditorContextProviderProps) {
index => {
setTabState(current => {
const updated = {
...synchronizeActiveTabValues(current),
...current,
activeTabIndex: index,
};
storeTabs(updated);
Expand All @@ -400,7 +400,7 @@ export function EditorContextProvider(props: EditorContextProviderProps) {
return updated;
});
},
[onTabChange, setEditorValues, storeTabs, synchronizeActiveTabValues],
[onTabChange, setEditorValues, storeTabs],
);

const closeTab = useCallback<EditorContextType['closeTab']>(
Expand Down

0 comments on commit 911cf3e

Please sign in to comment.