Skip to content

Commit

Permalink
mostly working!
Browse files Browse the repository at this point in the history
  • Loading branch information
acao committed Aug 30, 2024
1 parent 55f9397 commit 1e6822f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 6 additions & 1 deletion packages/graphiql-react/src/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import { HistoryContextProvider, HistoryContextProviderProps } from './history';
import { PluginContextProvider, PluginContextProviderProps } from './plugin';

import { StorageContextProvider, StorageContextProviderProps } from './storage';
import { createContext, useContext, useRef } from 'react';
import { createContext, useContext, useEffect, useRef } from 'react';
import { useStore } from 'zustand';

export type GraphiQLProviderProps = UserOptions &
ExplorerContextProviderProps &
Expand Down Expand Up @@ -101,6 +102,10 @@ export function GraphiQLProvider({
fetchOptions,
}),
).current;
const state = useStore(store);
useEffect(() => {
state.schema.introspect();
}, [state.execution.fetcher]);

Check warning on line 108 in packages/graphiql-react/src/provider.tsx

View workflow job for this annotation

GitHub Actions / ESLint

React Hook useEffect has a missing dependency: 'state.schema'. Either include it or remove the dependency array
return (
<GraphiQLStoreContext.Provider value={store}>
<StorageContextProvider storage={storage}>
Expand Down
9 changes: 5 additions & 4 deletions packages/graphiql-toolkit/src/zustand/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ const middlewares = (
return createStore<GraphiQLState>()(
immer(
devtools(
persist(fn, {
storage: createJSONStorage(() => storage),
name: 'graphiql',
}),
fn,
// persist(fn, {
// storage: createJSONStorage(() => storage),
// name: 'graphiql',
// }),
),
),
);
Expand Down

0 comments on commit 1e6822f

Please sign in to comment.