-
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
add editor context and useHeaderEditor
hook to @graphiql/react
#2404
add editor context and useHeaderEditor
hook to @graphiql/react
#2404
Conversation
🦋 Changeset detectedLatest commit: 63dd771 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report
@@ Coverage Diff @@
## main #2404 +/- ##
==========================================
- Coverage 65.70% 65.40% -0.31%
==========================================
Files 85 81 -4
Lines 5106 5185 +79
Branches 1631 1678 +47
==========================================
+ Hits 3355 3391 +36
- Misses 1747 1790 +43
Partials 4 4
Continue to review full report at Codecov.
|
7036641
to
fd31afe
Compare
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.
LGTM!
Continuing moving over stuff to
@graphiql/react
, next up is a context that stores the editor instances. I also created auseHeaderEditor
hook that contains all the logic for this editor and just returns the ref that needs to be passed to adiv
element.Notes (also will add some inline comments):
HeaderEditor
component will be moved in a follow up, I'll try to do this together with design changes.@graphiql/react
we can remove these utils from thegraphiql
package. (I'll mark these files with inline comments.)headers
state property from theGraphiQL
component, we now always derive the current value by looking at theheaders
props and read the editor value if this prop value isundefined
. The logic for keeping the editor value in sync is all part of theuseHeaderEditor
hook.