From 61a4a1ea3bf0487045ad621bd46b4ad4d679ee61 Mon Sep 17 00:00:00 2001 From: JBodkin-Amphora Date: Tue, 11 Nov 2025 10:03:47 +0000 Subject: [PATCH] Upgrade to GraphiQL 5.2.1 Signed-off-by: JBodkin-Amphora --- .../src/main/resources/graphiql/index.html | 45 +++++++------------ 1 file changed, 16 insertions(+), 29 deletions(-) diff --git a/spring-graphql/src/main/resources/graphiql/index.html b/spring-graphql/src/main/resources/graphiql/index.html index 36bb6360b..a3a4671a8 100644 --- a/spring-graphql/src/main/resources/graphiql/index.html +++ b/spring-graphql/src/main/resources/graphiql/index.html @@ -19,20 +19,22 @@ font-size: 4rem; } - - + + @@ -42,33 +44,18 @@ import { GraphiQL, HISTORY_PLUGIN } from 'graphiql'; import { createGraphiQLFetcher } from '@graphiql/toolkit'; import { explorerPlugin } from '@graphiql/plugin-explorer'; - - import createJSONWorker from 'https://esm.sh/monaco-editor/esm/vs/language/json/json.worker.js?worker'; - import createGraphQLWorker from 'https://esm.sh/monaco-graphql/esm/graphql.worker.js?worker'; - import createEditorWorker from 'https://esm.sh/monaco-editor/esm/vs/editor/editor.worker.js?worker'; - - globalThis.MonacoEnvironment = { - getWorker(_workerId, label) { - switch (label) { - case 'json': - return createJSONWorker(); - case 'graphql': - return createGraphQLWorker(); - } - return createEditorWorker(); - }, - }; + import 'graphiql/setup-workers/esm.sh'; const params = new URLSearchParams(window.location.search); - const path = params.get("path") || "/graphql"; + const path = params.get('path') || '/graphql'; const url = `${location.protocol}//${location.host}${path}`; - const wsPath = params.get("wsPath") || "/graphql"; + const wsPath = params.get('wsPath') || '/graphql'; const wsProtocol = location.protocol === 'https:' ? 'wss:' : 'ws:'; const subscriptionUrl = `${wsProtocol}//${location.host}${wsPath}`; const gqlFetcher = createGraphiQLFetcher({'url': url, 'subscriptionUrl': subscriptionUrl}); const plugins = [HISTORY_PLUGIN, explorerPlugin()]; const xsrfToken = document.cookie.match(new RegExp('(?:^| )XSRF-TOKEN=([^;]+)')); - const initialHeaders = xsrfToken ? `{ "X-XSRF-TOKEN" : "${ xsrfToken[1] }" }` : `{}`; + const initialHeaders = xsrfToken ? `{ 'X-XSRF-TOKEN' : '${ xsrfToken[1] }' }` : undefined; function App() { return React.createElement(GraphiQL, { @@ -87,6 +74,6 @@ -
Loading...
+
Loading...
- \ No newline at end of file +