File tree Expand file tree Collapse file tree 3 files changed +53
-31
lines changed
graphiql-toolkit/src/zustand Expand file tree Collapse file tree 3 files changed +53
-31
lines changed Original file line number Diff line number Diff line change 38
38
"build-docs" : " rimraf packages/graphiql/typedoc && typedoc packages" ,
39
39
"build:nontsc" : " yarn wsrun:noexamples --exclude-missing --serial build" ,
40
40
"build:clean" : " yarn tsc --clean" ,
41
- "build:watch" : " yarn tsc --watch " ,
41
+ "build:watch" : " yarn wsrun:noexamples --done-criteria ' \" Build success in|built in \" ' -t dev " ,
42
42
"build-demo" : " wsrun -m build-demo" ,
43
43
"watch" : " yarn build:watch" ,
44
44
"watch-vscode" : " yarn tsc && yarn workspace vscode-graphql compile" ,
Original file line number Diff line number Diff line change @@ -80,36 +80,34 @@ export function GraphiQLProvider({
80
80
variables,
81
81
visiblePlugin,
82
82
} : GraphiQLProviderProps ) {
83
- const store = useMemo (
84
- ( ) =>
85
- createGraphiQLStore ( {
86
- defaultQuery,
87
- defaultHeaders,
88
- defaultTabs,
89
- externalFragments,
90
- fetcher,
91
- getDefaultFieldNames,
92
- headers,
93
- inputValueDeprecation,
94
- introspectionQueryName,
95
- onEditOperationName,
96
- onSchemaChange,
97
- onTabChange,
98
- schema,
99
- schemaDescription,
100
- shouldPersistHeaders,
101
- validationRules,
102
- dangerouslyAssumeSchemaIsValid,
103
- fetchOptions,
104
- } ) ,
105
- [ defaultQuery ] ,
106
- ) ;
83
+ const store = useRef (
84
+ createGraphiQLStore ( {
85
+ defaultQuery,
86
+ defaultHeaders,
87
+ defaultTabs,
88
+ externalFragments,
89
+ fetcher,
90
+ getDefaultFieldNames,
91
+ headers,
92
+ inputValueDeprecation,
93
+ introspectionQueryName,
94
+ onEditOperationName,
95
+ onSchemaChange,
96
+ onTabChange,
97
+ schema,
98
+ schemaDescription,
99
+ shouldPersistHeaders,
100
+ validationRules,
101
+ dangerouslyAssumeSchemaIsValid,
102
+ fetchOptions,
103
+ } ) ,
104
+ ) . current ;
107
105
108
106
const state = useStore ( store ) ;
109
107
110
108
useEffect ( ( ) => {
111
109
state . schema . introspect ( ) ;
112
- } , [ state . execution . fetcher ] ) ;
110
+ } , [ fetcher ] ) ;
113
111
return (
114
112
< GraphiQLStoreContext . Provider value = { store } >
115
113
< StorageContextProvider storage = { storage } >
Original file line number Diff line number Diff line change @@ -32,11 +32,35 @@ const middlewares = (
32
32
return createStore < GraphiQLState > ( ) (
33
33
immer (
34
34
devtools (
35
- // fn,
36
- persist ( fn , {
37
- storage : createJSONStorage ( ( ) => storage ) ,
38
- name : 'graphiql' ,
39
- } ) ,
35
+ fn ,
36
+ // TODO: more issues with persist middleware
37
+ // persist(fn, {
38
+ // storage: createJSONStorage(() => storage),
39
+ // name: 'graphiql',
40
+ // onRehydrateStorage: state => {
41
+ // return {
42
+ // ...state,
43
+ // editor: {
44
+ // ...state,
45
+
46
+ // }
47
+ // }
48
+ // // partialize: state => {
49
+ // // const {
50
+ // // editor: {
51
+ // // queryEditor,
52
+ // // variableEditor,
53
+ // // headerEditor,
54
+ // // responseEditor,
55
+ // // ...editorState
56
+ // // },
57
+ // // } = state;
58
+ // // console.log(state);
59
+ // // return {
60
+ // // editor: editorState,
61
+ // // };
62
+ // // },
63
+ // }),
40
64
) ,
41
65
) ,
42
66
) ;
You can’t perform that action at this time.
0 commit comments