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

feat: maintain DocExplorer stack on schema update #3012

Merged
merged 1 commit into from
Feb 19, 2023
Merged

feat: maintain DocExplorer stack on schema update #3012

merged 1 commit into from
Feb 19, 2023

Conversation

benjie
Copy link
Member

@benjie benjie commented Feb 1, 2023

Previously:

  • when you click the schema reload button, the doc explorer stack was reset even if the schema is unchanged 😞
  • when you passed a new schema in, the doc explorer stack is unaffected, meaning it can render invalid content or even crash in some circumstances 🐞

I'm not sure what the need for resetting the explorer stack is, so I've raised this PR to begin discussions. I believe that the doc explorer should only be reset when an incompatible schema is loaded, and even then we should aim to keep the compatible parts of the stack where possible. I've attempted to achieve this (and included tests for the same) in this PR.

@changeset-bot
Copy link

changeset-bot bot commented Feb 1, 2023

🦋 Changeset detected

Latest commit: c09abd1

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

This PR includes changesets to release 3 packages
Name Type
@graphiql/react Minor
graphiql Minor
@graphiql/plugin-explorer 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

@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 2023

The latest changes of this PR are available as canary in npm (based on the declared changesets):

@benjie
Copy link
Member Author

benjie commented Feb 1, 2023

@graphiql/react@npm:^0.17.0-canary-208963ff.0: No candidates found

I assume this is due to the token issues we're facing; hopefully we can get this sorted out soon after tomorrows WG meeting 👍

@benjie benjie requested a review from a team February 6, 2023 12:20
@acao
Copy link
Member

acao commented Feb 7, 2023

@benjie yep, just need my acao npm user to be added to graphiql organisation again

@acao
Copy link
Member

acao commented Feb 19, 2023

@benjie just tested manually and it works! thanks for this :)

@@ -87,4 +107,134 @@ describe('DocExplorer', () => {
const errors = container.querySelectorAll('.graphiql-doc-explorer-error');
expect(errors).toHaveLength(0);
});
it('maintains nav stack when possible', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<3

@acao acao merged commit 65f5176 into main Feb 19, 2023
@acao acao deleted the fix-nav-stack branch February 19, 2023 22:01
@acao acao mentioned this pull request Feb 19, 2023
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