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

Do not clear headers when switching between tabs #3552

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

klippx
Copy link

@klippx klippx commented Mar 6, 2024

Issue

When switching between tabs, the default header state is lost and replaced with empty string.

Demo of the bug:

Screen.Recording.2024-03-06.at.10.47.10.mov

Codepen to verify/reproduce the issue:

In this example we are using defaultHeaders, and when using multiple tabs, upon reload the headers are cleared when switching tabs.

https://codesandbox.io/p/sandbox/determined-brook-rp683x?file=/package.json:11,23

Note: If you edit the headers before switching tabs, they are not cleared. I am guessing that they are then instead stored in the internal state.

Copy link

changeset-bot bot commented Mar 6, 2024

🦋 Changeset detected

Latest commit: 94b09ad

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

This PR includes changesets to release 4 packages
Name Type
@graphiql/react Patch
@graphiql/plugin-code-exporter Patch
@graphiql/plugin-explorer Patch
graphiql 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

@acao
Copy link
Member

acao commented Mar 6, 2024

good find, thank you!

Copy link

codecov bot commented Mar 6, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 55.32%. Comparing base (29e99a8) to head (e219fea).

❗ Current head e219fea differs from pull request most recent head 94b09ad. Consider uploading reports for the commit 94b09ad to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3552      +/-   ##
==========================================
- Coverage   55.33%   55.32%   -0.01%     
==========================================
  Files         115      115              
  Lines        5349     5348       -1     
  Branches     1450     1450              
==========================================
- Hits         2960     2959       -1     
+ Misses       1963     1962       -1     
- Partials      426      427       +1     
Files Coverage Δ
packages/graphiql-react/src/editor/tabs.ts 63.75% <0.00%> (-1.25%) ⬇️

... and 1 file with indirect coverage changes

@klippx
Copy link
Author

klippx commented Mar 12, 2024

@acao Would it be OK to merge?

@klippx klippx force-pushed the stop-clearing-headers branch 2 times, most recently from 241bb5b to f87c895 Compare March 18, 2024 13:36
@klippx
Copy link
Author

klippx commented Mar 18, 2024

I pushed another commit since it would just use whatever you have in the editor and not overwrite it, using default headers is a better choice when switching tabs.

Before:

  • Default headers only apply when creating a NEW tab
    After:
  • When switching tab, apply headers || defaultHeaders

@klippx klippx requested a review from acao March 18, 2024 16:10
@klippx
Copy link
Author

klippx commented Apr 8, 2024

I have two PRs open that initially seem well received, how come we don't move forward and merge if they are perceived as good changes? @acao

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

2 participants