Skip to content

Commit f5d46f8

Browse files
committed
polish
1 parent 4c3f223 commit f5d46f8

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

packages/graphiql-plugin-doc-explorer/src/context.tsx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,9 @@ export const docExplorerStore = createStore<DocExplorerStoreType>(
270270
export const DocExplorerStore: FC<{
271271
children: ReactNode;
272272
}> = ({ children }) => {
273-
const { schema, validationErrors, schemaReference, visiblePlugin } =
274-
useGraphiQL(
275-
pick('schema', 'validationErrors', 'schemaReference', 'visiblePlugin'),
276-
);
273+
const { schema, validationErrors, schemaReference } = useGraphiQL(
274+
pick('schema', 'validationErrors', 'schemaReference'),
275+
);
277276

278277
useEffect(() => {
279278
const { resolveSchemaReferenceToNavItem } =
@@ -307,12 +306,10 @@ export const DocExplorerStore: FC<{
307306
if (!shouldFocusInput) {
308307
return;
309308
}
310-
if (visiblePlugin !== DOC_EXPLORER_PLUGIN) {
311-
const button = document.querySelector<HTMLButtonElement>(
312-
'.graphiql-sidebar button[aria-label*="Documentation Explorer"]',
313-
);
314-
button?.click();
315-
}
309+
const button = document.querySelector<HTMLButtonElement>(
310+
'.graphiql-sidebar button[aria-label="Show Documentation Explorer"]',
311+
);
312+
button?.click();
316313
// Execute on next tick when doc explorer is opened and input exists in DOM
317314
requestAnimationFrame(() => {
318315
const el = document.querySelector<HTMLDivElement>(
@@ -326,7 +323,7 @@ export const DocExplorerStore: FC<{
326323
return () => {
327324
window.removeEventListener('keydown', handleKeyDown);
328325
};
329-
}, [visiblePlugin]);
326+
}, []);
330327

331328
return children as ReactElement;
332329
};

0 commit comments

Comments
 (0)