@@ -14,11 +14,11 @@ import {
1414 createExecutionSlice ,
1515 createPluginSlice ,
1616 createSchemaSlice ,
17+ EditorProps ,
18+ ExecutionProps ,
19+ PluginProps ,
20+ SchemaProps ,
1721} from '../stores' ;
18- import { EditorProps , PERSIST_HEADERS_STORAGE_KEY } from '../stores/editor' ;
19- import { ExecutionProps } from '../stores/execution' ;
20- import { PluginProps , STORAGE_KEY_VISIBLE_PLUGIN } from '../stores/plugin' ;
21- import { SchemaProps } from '../stores/schema' ;
2222import { StorageStore , useStorage } from '../stores/storage' ;
2323import { ThemeStore } from '../stores/theme' ;
2424import { SlicesWithActions } from '../types' ;
@@ -30,10 +30,11 @@ import {
3030 isSchema ,
3131 validateSchema ,
3232} from 'graphql' ;
33- import { DEFAULT_PRETTIFY_QUERY , DEFAULT_QUERY } from '../constants' ;
34- import { STORAGE_KEY_QUERY } from './query-editor' ;
35- import { STORAGE_KEY as STORAGE_KEY_VARIABLES } from './variable-editor' ;
36- import { STORAGE_KEY as STORAGE_KEY_HEADERS } from './header-editor' ;
33+ import {
34+ DEFAULT_PRETTIFY_QUERY ,
35+ DEFAULT_QUERY ,
36+ STORAGE_KEY ,
37+ } from '../constants' ;
3738import { getDefaultTabState } from '../utility/tabs' ;
3839
3940interface InnerGraphiQLProviderProps
@@ -121,25 +122,25 @@ const InnerGraphiQLProvider: FC<InnerGraphiQLProviderProps> = ({
121122 // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- false positive
122123 if ( storeRef . current === null ) {
123124 function getInitialVisiblePlugin ( ) {
124- const storedValue = storage . get ( STORAGE_KEY_VISIBLE_PLUGIN ) ;
125+ const storedValue = storage . get ( STORAGE_KEY . visiblePlugin ) ;
125126 const pluginForStoredValue = plugins . find (
126127 plugin => plugin . title === storedValue ,
127128 ) ;
128129 if ( pluginForStoredValue ) {
129130 return pluginForStoredValue ;
130131 }
131132 if ( storedValue ) {
132- storage . set ( STORAGE_KEY_VISIBLE_PLUGIN , '' ) ;
133+ storage . set ( STORAGE_KEY . visiblePlugin , '' ) ;
133134 }
134135 return visiblePlugin ;
135136 }
136137
137138 function getInitialState ( ) {
138139 // We only need to compute it lazily during the initial render.
139- const query = props . query ?? storage . get ( STORAGE_KEY_QUERY ) ?? null ;
140+ const query = props . query ?? storage . get ( STORAGE_KEY . query ) ?? null ;
140141 const variables =
141- props . variables ?? storage . get ( STORAGE_KEY_VARIABLES ) ?? null ;
142- const headers = props . headers ?? storage . get ( STORAGE_KEY_HEADERS ) ?? null ;
142+ props . variables ?? storage . get ( STORAGE_KEY . variables ) ?? null ;
143+ const headers = props . headers ?? storage . get ( STORAGE_KEY . headers ) ?? null ;
143144 const response = props . response ?? '' ;
144145
145146 const { tabs, activeTabIndex } = getDefaultTabState ( {
@@ -152,11 +153,11 @@ const InnerGraphiQLProvider: FC<InnerGraphiQLProviderProps> = ({
152153 variables,
153154 } ) ;
154155
155- const isStored = storage . get ( PERSIST_HEADERS_STORAGE_KEY ) !== null ;
156+ const isStored = storage . get ( STORAGE_KEY . persistHeaders ) !== null ;
156157
157158 const $shouldPersistHeaders =
158159 shouldPersistHeaders !== false && isStored
159- ? storage . get ( PERSIST_HEADERS_STORAGE_KEY ) === 'true'
160+ ? storage . get ( STORAGE_KEY . persistHeaders ) === 'true'
160161 : shouldPersistHeaders ;
161162
162163 const store = create < SlicesWithActions > ( ( ...args ) => {
0 commit comments