-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Update the header editor to work in the 2.0 version of GraphiQL #1590
Update the header editor to work in the 2.0 version of GraphiQL #1590
Conversation
I think this mostly works :D
@@ -34,6 +36,7 @@ export const initialState: SessionState = { | |||
sessionId: 0, | |||
operation: { uri: 'graphql://graphiql/operations/0.graphql' }, | |||
variables: { uri: 'graphql://graphiql/variables/0.graphql' }, | |||
headers: { uri: 'graphql://graphiql/variables/1.graphql' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is what we want here? The problem would be that the session state would be trying to pull from whatever the second tab is regardless of whether the headers editor is enabled.
hey, i'm terribly sorry but this was supposed to be a plugin. we need plugin API first! |
2.0.0 alpha still has massive restructuring/rewriting to do before we can start introducing more features. this will be implemented as a plugin using the plugin API. See the pinned issue #983 |
Fine by me, like I said I just did this on a whim :) |
re-opened for reference, because I'm going to be borrowing most of this for the plugin! the only difference is the imports really: import { jsx } from 'theme-ui';
import React from 'react';
import { EditorWrapper } from '@graphiql/sdk';
import { useEditorsContext } from '@graphiql/sdk';
import { useSessionContext } from '@graphiql/sdk';
import type { EditorOptions } from '@graphiql/sdk'; and a plugin definition |
4fa9ca3
to
1c11938
Compare
@connorshea thank you for all your work on this! we're working towards a new 2.0 initiative, and there the header editor is still working. please join us if you're able! |
Surprisingly, I think this mostly works. I originally intended to just try this because I wanted to mess with the 2.0 editor, but this actually seems to work surprisingly well.
I'm not sure if we wanted the headers editor as a plugin for 2.0, or something else?
I didn't spend that long on this, so if this isn't the route we want to go down that's fine by me. Like I said, I didn't originally intend for this to end up becoming anything.