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

fix: react state bugs, new tab on existing non-blank or matching query #23

Merged
merged 8 commits into from
Nov 6, 2023

Conversation

acao
Copy link
Contributor

@acao acao commented Oct 31, 2023

implements @graphiql/react hooks as a way to prevent undesired state propogation that causes bugs

this was the same solution to the issue for explorer plugin, so it appears to fix both the jumping cursor and operation name state issues!

NOTE: temporarily pinned to canary versions until release is ready

Behavior:

  1. if the URL contains a hash, and the current query is blank, or is the default query, it overrides the editor value.
  2. if the above conditions aren't met, it adds a new tab and sets the value from the URL hash
  3. it the current editor tab contains a query that's the same as the one in the URL, nothing happens

Copy link

vercel bot commented Oct 31, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
saleor-graphql-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 2, 2023 1:59pm

@CLAassistant
Copy link

CLAassistant commented Oct 31, 2023

CLA assistant check
All committers have signed the CLA.

@acao
Copy link
Contributor Author

acao commented Nov 2, 2023

I want to add one last change, where readFromUrl doesn't return defaultQuery so the comparison for default query will no longer be needed, which will make it slightly faster when replacing default query with a new value, and less logic

Edit: this is complete :)

@acao acao changed the title fix: react state propogation bugs by using hooks directly fix: react state bugs, new tab on existing non-blank or matching query Nov 2, 2023
Copy link
Contributor

@zaiste zaiste left a comment

Choose a reason for hiding this comment

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

@acao Thank you for this!! 🎉

@zaiste zaiste merged commit 3966cac into saleor:main Nov 6, 2023
3 checks passed
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.

None yet

3 participants