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: GraphiQL clears request after page refresh (close #6521) #6533

Closed
wants to merge 1 commit into from

Conversation

iykekings
Copy link
Contributor

This fixes the issue with graphlQl queries not persisting after refresh. (close #6521)

Description

This fix ensures that the queries are persisted in LocalStorage and also displayed on refresh/reload.

Changelog

  • CHANGELOG.md is updated with user-facing content relevant to this PR. If no changelog is required, then add theno-changelog-required label.

Affected components

  • Server
  • Console
  • CLI
  • Docs
  • Community Content
  • Build System
  • Tests
  • Other (list it)

Related Issues

#6521

Steps to test and verify

  • Type and run a graphQl query in the console
  • Refresh the page
  • If the query is persisted, then it works.

Limitations, known bugs & workarounds

I'm not sure this is a limitation, but this PR used flatten from lodash. Array.prototype.flatMap might have been better but out typescript lib typedefs doesn't include it yet.

Does this PR add a new Metadata feature?

  • No

GraphQL

  • No new GraphQL schema is generated

Breaking changes

  • No Breaking changes

@iykekings iykekings requested a review from beerose February 8, 2021 11:26
@iykekings iykekings requested a review from a team as a code owner February 8, 2021 11:26
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


iykekings seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@netlify
Copy link

netlify bot commented Feb 8, 2021

Deploy preview for hasura-docs ready!

Built with commit 2666ac8

https://deploy-preview-6533--hasura-docs.netlify.app

Comment on lines +124 to +126
tables: flatten(
state.metadata.metadataObject?.sources.map(s => s.tables)
),
Copy link
Contributor

Choose a reason for hiding this comment

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

Use selector from src/metadata/selector.ts. Create one if there isn't any.

@@ -5,6 +5,7 @@ import Helmet from 'react-helmet';
import ApiRequestWrapper from './ApiRequestWrapper';

import globals from '../../../Globals';
import { flatten } from 'lodash';
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's not introduce lodash just for it.

@iykekings iykekings closed this Feb 8, 2021
hasura-bot added a commit that referenced this pull request Feb 18, 2021
GITHUB_PR_NUMBER: 6533
GITHUB_PR_URL: #6533

Co-authored-by: Ikechukwu Eze <22247592+iykekings@users.noreply.github.com>
GitOrigin-RevId: 36bfa0b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1.4.0-alpha.1 - GraphiQL clears request after page refresh
4 participants