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

Function render

examples/monaco-graphql-webpack/src/index.ts:18–216  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16void render();
17
18async function render() {
19 if (!schemaFetcher.token) {
20 renderGithubLoginButton();
21
22 return;
23 }
24 monacoGraphQLAPI ||= initializeMode({
25 formattingOptions: {
26 prettierConfig: {
27 printWidth: 120,
28 },
29 },
30 });
31
32 document.getElementById('github-login-wrapper')?.remove();
33 document
34 .getElementById('session-editor')
35 ?.setAttribute('style', 'display: flex');
36 document
37 .getElementById('toolbar')
38 ?.setAttribute('style', 'display: inline-flex');
39
40 const toolbar = document.getElementById('toolbar');
41 const editors = createEditors();
42 const {
43 operationModel,
44 operationEditor,
45 variablesEditor,
46 schemaEditor,
47 resultsEditor,
48 variablesModel,
49 schemaModel,
50 } = editors;
51 const { schemaReloadButton, executeOpButton, schemaPicker } =
52 renderToolbar(toolbar);
53
54 renderGithubLoginButton();
55
56 const operationUri = operationModel.uri.toString();
57
58 const schema = await schemaFetcher.loadSchema();
59 if (schema) {
60 console.log('loaded schema', schema);
61 monacoGraphQLAPI.setSchemaConfig([
62 { ...schema, fileMatch: [operationUri, schemaModel.uri.toString()] },
63 ]);
64
65 schemaEditor.setValue(schema.documentString || '');
66 }
67
68 monacoGraphQLAPI.setDiagnosticSettings({
69 validateVariablesJSON: {
70 [operationUri]: [variablesModel.uri.toString()],
71 },
72 jsonDiagnosticSettings: {
73 // jsonc tip!
74 allowComments: true,
75 schemaValidation: 'error',

Callers 9

onMouseHoverFunction · 0.85
type-link.spec.tsxFile · 0.85
GraphiQL.spec.tsxFile · 0.85
index.tsFile · 0.85
renderGithubLoginButtonFunction · 0.85

Calls 11

createEditorsFunction · 0.90
renderGithubLoginButtonFunction · 0.85
initializeModeFunction · 0.85
renderToolbarFunction · 0.85
getOperationHandlerFunction · 0.85
loadSchemaMethod · 0.80
setSchemaConfigMethod · 0.80
setDiagnosticSettingsMethod · 0.80
overrideSchemaMethod · 0.80
changeSchemaMethod · 0.80
logMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…