graphiql icon indicating copy to clipboard operation
graphiql copied to clipboard

[graphiql] Headers disappear with persistent enabled

Open markedwards opened this issue 1 year ago • 6 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

The default behavior (at least on 3.0.0) seems broken:

  1. Set Persist headers to On in the UI Add headers
  2. Reload, observe that headers are persisted, but that the setting has reverted
  3. Reload again, observe that headers have now vanished

Expected Behavior

Headers should persist if this option is enabled by the user, and the option should stick.

Steps To Reproduce

See description.

Environment

  • GraphiQL Version: 3.0.0
  • OS: any
  • Browser: any
  • Bundler:
  • react Version:
  • graphql Version:

Anything else?

No response

markedwards avatar Jul 24 '23 18:07 markedwards

coming back to this asap, hopefully this weekend, just noting where I probably broke this for later: https://github.com/graphql/graphiql/pull/3371

I thought I had implemented an e2e test for this?

fwiw, we just need to make this enabled by default, this was planned for the last major version as a breaking change but it definitely should happen for the next. the only reason we don't is because of the security issue

acao avatar Sep 26 '23 21:09 acao

If possible, fix the header saving

kostyaten avatar Oct 09 '23 22:10 kostyaten

A PR is welcome here, as the end to end tests seem to show this working, and my grant scope of work has me focused on the LSP server & vscode extensions in this repo

acao avatar Jan 15 '24 02:01 acao

in the meantime, if you want this to be enabled by default for users, specify shouldPersistHeaders prop

acao avatar Jan 15 '24 02:01 acao

(Moving my comment from the original issue)

I see that Persist headers in UI also goes back to Off upon refresh. In other words, the Persist headers setting isn't persisted across refreshes. That also probably explains why headers are restored on the first reload but lost on the second.

ramnivas avatar Jan 15 '24 02:01 ramnivas