-
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
feat: Add Headers Editor to GraphiQL #1543
Conversation
It doesn't actually send the headers, and has some weird behavior right now.
I'll also need to create a compatibility layer for the I don't really like the new name |
@connorshea this is looking great! yes that sounds good! for deprecating a prop, we can just note it in the readme. |
fyi your code already passes the linter and prettier check, only thing failing now is unit/cypress tests |
@connorshea great work! In the above GIF you can see that when I click on the tab the editor is not being opened. |
This way the editors are persisted when switching tabs.
…e-by-side. Despite the other editor being rendered as display: none, the gutter for some reason would get squished by CodeMirror. This is the only thing I've figured out that will fix it. I _think_ this works because setting position: absolute will take it out of the normal document flow, but I'm not entirely sure.
@harshithpabbati I think I've fixed it so the editor contents persists now. It only came at the expense of a terrible hack to get the editor gutters to render properly when the page thought there were two editors rendered :) |
The prop will default to true. Also fixed headers not being initialized as part of the initial component state, this way default headers can be passed into the component.
Should I add functions for handleToggleDocs = () => {
if (typeof this.props.onToggleDocs === 'function') {
this.props.onToggleDocs(!this.state.docExplorerOpen);
}
this.setState({ docExplorerOpen: !this.state.docExplorerOpen });
};
handleToggleHistory = () => {
if (typeof this.props.onToggleHistory === 'function') {
this.props.onToggleHistory(!this.state.historyPaneOpen);
}
this.setState({ historyPaneOpen: !this.state.historyPaneOpen });
}; EDIT: Actually, I guess it wouldn't be |
Unrelated to this PR, but I just noticed onToggleHistory isn't documented in the |
@harshithpabbati maybe someone could do a layout like that in 2.0.0 but this design is more consistent |
@connorshea another tweak would be to use grayscale instead of red for the accent/activity color, otherwise it's looking pretty good! |
@connorshea are you able to make that final change? |
I will just go ahead and merge, and adjust the colors in another PR. thanks for all this work! |
@acao the active/inactive tabs are now black and gray and I've added the FetcherOpts change. |
@connorshea thank you! sorry if it's kinda boring, just wanted to make sure it's neutral for now. the more exciting design is for 2.0.0! |
ah hm, something about the cypress suite executing queries, and JSON parsing, interesting. you should be able to run |
@acao no problem, I was fully aware it didn't look very good in the initial implementation :) I'll take a look at the cypress tests. |
@acao should be good to go now :) |
@connorshea oops! so my suggestion to change the text color actually introduced an accessibility debt, my bad. I'm going to make another PR to address a few other issues I discovered in a cursory, automated runtime audit |
Which version of graphql would this have landed in? I just went and got the latest from npm |
Hi, you need to pass in You can look at the props here. |
Awesome, I see it now. I changed it to |
This adds a header editor, for submitting HTTP headers when executing a query, as described in #59.
This is especially useful when you want to send an authentication token with your request, for example.
This adds an optional
headers
parameter to thefetcher
which can then be merged into any other headers that the application sets itself.TODO: