Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions gui/graphql/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion gui/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@graphiql/plugin-explorer": "^5.1.4",
"assert": "^2.1.0",
"graphiql": "^5.3.0",
"graphql": "^15.8.0",
"graphql": "^17.0.2",
"graphql-ws": "^6.2.1",
"react": "^19.2.8",
"react-dom": "^19.2.8"
Expand Down
209 changes: 112 additions & 97 deletions gui/graphql/public/graphql.worker.js

Large diffs are not rendered by default.

952 changes: 476 additions & 476 deletions gui/graphql/public/main.js

Large diffs are not rendered by default.

40 changes: 10 additions & 30 deletions gui/graphql/src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { explorerPlugin } from '@graphiql/plugin-explorer';
import '@graphiql/plugin-explorer/style.css';
import { GraphiQL } from "graphiql";
import "graphiql/style.css";
import { astFromValue, buildClientSchema, getIntrospectionQuery } from "graphql";
import { buildClientSchema, getIntrospectionQuery } from "graphql";
import React from "react"; // This import is required!!!
import { useEffect, useState } from "react";
import { createRoot } from 'react-dom/client';
Expand Down Expand Up @@ -73,34 +73,6 @@ const cleanSchema = schema => {
return schema;
};

// GraphiQL 5 hands the schema to the Monaco GraphQL worker as SDL, so every input default has to
// survive printSchema(). A custom scalar with an object default has no literal astFromValue can
// build — platformOS ships one, UpdateFormConfigurationInputType.configuration: HashObject = {} —
// and printSchema throws on the first one it meets, which costs the WHOLE schema its validation
// and autocompletion. Clearing just those defaults gives up nothing that SDL could have expressed
// anyway. Done by trying the conversion rather than by matching type names, so a new offending
// field in a later schema is handled without a change here.
const dropUnprintableDefaults = schema => {
for (const type of Object.values(schema.getTypeMap())) {
if (typeof type.getFields !== 'function') continue;
for (const field of Object.values(type.getFields())) {
// Object/interface fields carry their input values in `args`; input object fields are
// input values themselves.
for (const input of field.args ?? [field]) {
if (input.defaultValue === undefined) continue;
try {
astFromValue(input.defaultValue, input.type);
} catch {
// undefined, not null: null is a legitimate default and prints as `= null`.
input.defaultValue = undefined;
}
}
}
}

return schema;
};

// Built once, at module scope: the plugin object is part of GraphiQL's state, so rebuilding it
// on every render would reset the explorer as you type.
const explorer = explorerPlugin();
Expand All @@ -114,7 +86,15 @@ function App() {
fetcher({
query: getIntrospectionQuery()
}).then(result => {
setSchema(dropUnprintableDefaults(buildClientSchema(cleanSchema(result.data))));
// GraphiQL 5 hands the schema to the Monaco GraphQL worker as SDL, so every input default
// has to survive printSchema(). Under graphql 17 they all do: buildClientSchema keeps an
// introspected default as the literal the server sent it as, and printSchema prints that
// literal back. Nothing reconstructs a literal from a coerced value any more, so a custom
// scalar with an object default — platformOS ships one,
// UpdateFormConfigurationInputType.configuration: HashObject = {} — no longer costs the
// WHOLE schema its validation and autocompletion. Under graphql 15 it did, and this call
// was wrapped in a pass that cleared those defaults; don't reintroduce it.
setSchema(buildClientSchema(cleanSchema(result.data)));
});
}, []);

Expand Down
1 change: 1 addition & 0 deletions gui/next/build/_app/immutable/chunks/20VG2--Z.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gui/next/build/_app/immutable/chunks/4TnyQOX7.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gui/next/build/_app/immutable/chunks/6QBD3Nmg.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading