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

always use the latest header values for introspection #2451

Merged
merged 1 commit into from
May 31, 2022

Conversation

thomasheyenbrock
Copy link
Collaborator

Fixes #2442

After introducing the schema context, we might dispatch introspection queries after the initial one that don't use the latest header values, but the initial ones. This PR fixes this:

  • We derive the initial editor values in the EditorContextProvider and also expose them on the context value. The editor hooks don't need to do this logic anymore and can just consume the initial value from the context.
  • Also syncing the prop value with the editor state (i.e. the calls to useSynchronizeValue) have been moved to the EditorContextProvider, that way we only need to pass the defaultQuery, query, variables, and headers prop to the context provider and not also the editor hooks.
  • We consume the editor context inside the SchemaContextProvider to make sure that we use the latest header values when initializing an introspection request.

@changeset-bot
Copy link

changeset-bot bot commented May 30, 2022

🦋 Changeset detected

Latest commit: b4aa4d8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
graphiql Patch
@graphiql/react Patch

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

@thomasheyenbrock thomasheyenbrock force-pushed the refactor/move-context-methods-to-hooks branch from f35d370 to eaa9160 Compare May 30, 2022 08:06
@codecov
Copy link

codecov bot commented May 30, 2022

Codecov Report

Merging #2451 (b4aa4d8) into main (2d91916) will increase coverage by 3.86%.
The diff coverage is 69.52%.

@@            Coverage Diff             @@
##             main    #2451      +/-   ##
==========================================
+ Coverage   65.70%   69.57%   +3.86%     
==========================================
  Files          85       71      -14     
  Lines        5106     4388     -718     
  Branches     1631     1452     -179     
==========================================
- Hits         3355     3053     -302     
+ Misses       1747     1330     -417     
- Partials        4        5       +1     
Impacted Files Coverage Δ
packages/codemirror-graphql/src/hint.ts 94.73% <ø> (ø)
packages/codemirror-graphql/src/lint.ts 100.00% <ø> (ø)
packages/codemirror-graphql/src/results/mode.ts 47.05% <ø> (ø)
...kages/codemirror-graphql/src/utils/forEachState.ts 100.00% <ø> (ø)
packages/codemirror-graphql/src/utils/hintList.ts 95.65% <ø> (ø)
...ckages/codemirror-graphql/src/utils/mode-indent.ts 0.00% <0.00%> (ø)
packages/codemirror-graphql/src/variables/hint.ts 89.70% <ø> (ø)
packages/codemirror-graphql/src/variables/mode.ts 79.48% <ø> (ø)
packages/graphiql-react/src/editor/whitespace.ts 100.00% <ø> (ø)
packages/graphiql-toolkit/src/storage/query.ts 36.73% <ø> (ø)
... and 90 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1e6fc68...b4aa4d8. Read the comment docs.

@thomasheyenbrock thomasheyenbrock force-pushed the refactor/move-context-methods-to-hooks branch from eaa9160 to f60b0c8 Compare May 31, 2022 06:53
Base automatically changed from refactor/move-context-methods-to-hooks to main May 31, 2022 07:00
@github-actions
Copy link
Contributor

The latest changes of this PR are not available as canary, since there are no linked changesets for this PR.

@thomasheyenbrock thomasheyenbrock merged commit 0659e96 into main May 31, 2022
@thomasheyenbrock thomasheyenbrock deleted the issues/2442 branch May 31, 2022 07:16
@acao acao mentioned this pull request May 31, 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.

Introspection Query always uses initial headers
2 participants