Skip to content
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

Closed

Conversation

connorshea
Copy link
Contributor

@connorshea connorshea commented Jun 21, 2020

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.

image

@@ -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' },
Copy link
Contributor Author

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.

@acao
Copy link
Member

acao commented Jun 22, 2020

hey, i'm terribly sorry but this was supposed to be a plugin. we need plugin API first!

@acao
Copy link
Member

acao commented Jun 22, 2020

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

@connorshea
Copy link
Contributor Author

Fine by me, like I said I just did this on a whim :)

@connorshea connorshea closed this Jun 24, 2020
@acao acao reopened this Jun 25, 2020
@acao
Copy link
Member

acao commented Jun 25, 2020

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

@acao
Copy link
Member

acao commented Jun 14, 2022

@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!

@acao acao closed this Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants