New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[graphiql] optional fetcher, user network configuration tab #2795
Comments
Updated ProposalMaking URL a potentially internal state is the most important outcome. Other plugins can manage multiple projects, First, the props will contain a discriminated union: type FetcherFirst = {
url?: string,
subscriptionsUrl?: string
fetcher: Fetcher
}
type UrlFirst = {
url: string,
subscriptionsUrl?: string
fetcher?: Fetcher
}
FetcherFirst | UrlFirst url state becomes a potentially dynamic internal detail: const fetcher: Fetcher = async (graphQLParams, options) => {
const data = await fetch(
options.url,
{
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
...options.headers,
},
body: JSON.stringify(graphQLParams),
credentials: 'same-origin',
},
);
return data.json().catch(() => data.text());
}; Context Changes:
createGraphiQLFetcher() change
fetcher and no url: assumes the user has statically provided a URL to the fetcher fetcher and url fetcher passes url and no fetcher: url is used to generate a |
A long requested feature, and what we envisioned for the sidebar plugin ecosystem a few years ago, is a place where users can configure their environments and settings for each environment
the network tab would provide a global setting for:
Accept: application/graphql-response+json
transparentlythe network tab would provide per-environment settings for:
How will this impact GraphiQL?
fetcher
becomes optional ifenvironments
prop is providedenvironments
prop looks likegraphql-config
object but maybe stricter (difficult to normalise every pattern)@graphiql/toolkit
createGraphiQLFetcher()
becomes an internal detail ifenvironments
prop is provided?The text was updated successfully, but these errors were encountered: