MCPcopy Index your code
hub / github.com/graphql/graphiql / useCopyQuery

Function useCopyQuery

packages/graphiql-react/src/editor/hooks.ts:177–192  ·  view source on GitHub ↗
({ caller, onCopyQuery }: UseCopyQueryArgs = {})

Source from the content-addressed store, hash-verified

175const _useAutoCompleteLeafs = useAutoCompleteLeafs;
176
177export function useCopyQuery({ caller, onCopyQuery }: UseCopyQueryArgs = {}) {
178 const { queryEditor } = useEditorContext({
179 nonNull: true,
180 caller: caller || _useCopyQuery,
181 });
182 return () => {
183 if (!queryEditor) {
184 return;
185 }
186
187 const query = queryEditor.getValue();
188 copyToClipboard(query);
189
190 onCopyQuery?.(query);
191 };
192}
193
194type UseMergeQueryArgs = {
195 /**

Callers 2

useQueryEditorFunction · 0.90
GraphiQLToolbarFunction · 0.90

Calls 1

useEditorContextFunction · 0.85

Tested by

no test coverage detected