MCPcopy
hub / github.com/graphql/graphiql / createTab

Function createTab

packages/graphiql-react/src/editor/tabs.ts:293–309  ·  view source on GitHub ↗
({
  query = null,
  variables = null,
  headers = null,
}: Partial<TabDefinition> = {})

Source from the content-addressed store, hash-verified

291}
292
293export function createTab({
294 query = null,
295 variables = null,
296 headers = null,
297}: Partial<TabDefinition> = {}): TabState {
298 const operationName = query ? fuzzyExtractOperationName(query) : null;
299 return {
300 id: guid(),
301 hash: hashFromTabContents({ query, variables, headers }),
302 title: operationName || DEFAULT_TITLE,
303 query,
304 variables,
305 headers,
306 operationName,
307 response: null,
308 };
309}
310
311export function setPropertiesInActiveTab(
312 state: TabsState,

Callers 2

addTabFunction · 0.90
tabs.spec.tsFile · 0.90

Calls 3

guidFunction · 0.85
hashFromTabContentsFunction · 0.85

Tested by

no test coverage detected