-
Notifications
You must be signed in to change notification settings - Fork 610
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: patch GraphQL Playground's tooltips issue (#4272)
- Loading branch information
Showing
2 changed files
with
16 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ import { config as appConfig } from "@webiny/app/config"; | |
import ApolloClient from "apollo-client"; | ||
import { GraphQLPlaygroundTabPlugin } from "~/types"; | ||
import { SecurityIdentity } from "@webiny/app-security/types"; | ||
import { ORIGINAL_GQL_PLAYGROUND_URL, PATCHED_GQL_PLAYGROUND_URL } from "./constants"; | ||
|
||
const withHeaders = (link: ApolloLink, headers: Record<string, string>): ApolloLink => { | ||
return ApolloLink.from([ | ||
|
@@ -39,16 +40,20 @@ const initScripts = () => { | |
return resolve(); | ||
} | ||
|
||
return loadScript( | ||
"https://cdn.jsdelivr.net/npm/@apollographql/[email protected]/build/static/js/middleware.js", | ||
resolve | ||
); | ||
loadScript(PATCHED_GQL_PLAYGROUND_URL, (err: Error) => { | ||
if (err) { | ||
return loadScript(ORIGINAL_GQL_PLAYGROUND_URL, resolve); | ||
} | ||
|
||
resolve(); | ||
}); | ||
}); | ||
}; | ||
|
||
interface CreateApolloClientParams { | ||
uri: string; | ||
} | ||
|
||
interface PlaygroundProps { | ||
createApolloClient: (params: CreateApolloClientParams) => ApolloClient<any>; | ||
} | ||
|
@@ -57,9 +62,11 @@ interface CreateApolloLinkCallableParams { | |
endpoint: string; | ||
headers: Record<string, string>; | ||
} | ||
|
||
interface CreateApolloLinkCallableResult { | ||
link: ApolloLink; | ||
} | ||
|
||
interface CreateApolloLinkCallable { | ||
(params: CreateApolloLinkCallableParams): CreateApolloLinkCallableResult; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const ORIGINAL_GQL_PLAYGROUND_URL = | ||
"https://cdn.jsdelivr.net/npm/@apollographql/[email protected]/build/static/js/middleware.js"; | ||
|
||
export const PATCHED_GQL_PLAYGROUND_URL = | ||
"https://webiny-public.s3.us-east-2.amazonaws.com/project-scripts/gql-playground-mw-1.7.42-patched.js"; |