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: use the default query on adding a new tab #3441

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

Conversation

cimdalli
Copy link

When a new tab is added, it sets the query value as an empty string instead of defaultQuery value. Tab default query value should be defaultQuery variable if it's set on the component. Otherwise, it should be DEFAULT_QUERY constant.

@changeset-bot
Copy link

changeset-bot bot commented Oct 28, 2023

🦋 Changeset detected

Latest commit: 00aba1d

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 Patch
@graphiql/plugin-code-exporter Patch
@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

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Oct 28, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@acao
Copy link
Member

acao commented Oct 28, 2023

makes sense to me. do any other @graphql/graphiql-maintainers have feelings about this?

@codecov
Copy link

codecov bot commented Oct 28, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.81%. Comparing base (79d1d99) to head (ef4b1f7).

❗ Current head ef4b1f7 differs from pull request most recent head 00aba1d. Consider uploading reports for the commit 00aba1d to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3441      +/-   ##
==========================================
+ Coverage   55.31%   55.81%   +0.49%     
==========================================
  Files         115      114       -1     
  Lines        5351     5305      -46     
  Branches     1451     1443       -8     
==========================================
+ Hits         2960     2961       +1     
+ Misses       1965     1912      -53     
- Partials      426      432       +6     
Files Coverage Δ
packages/graphiql-react/src/editor/context.tsx 73.87% <100.00%> (+0.47%) ⬆️

... and 14 files with indirect coverage changes

@benjie
Copy link
Member

benjie commented Oct 28, 2023

I'm for this change 👍

@acao
Copy link
Member

acao commented Nov 15, 2023

two things:

  1. the cypress suite is failing on some tests you added
  2. the headers prop is a bit nuanced - however if it is set, then defaultHeaders should always be overridden. query, variables and headers prop, and soon extensions, should drive a controlled component state, at least I think? For 4.x I'm considering dropping all the controlled component props with a migration path to the @graphiql/react hooks instead, because it leads to a much more perfomant and easier to implement controlled component implementation

@acao
Copy link
Member

acao commented Jan 7, 2024

@cimdalli so it seems this clashes a bit with previously expected behavior:

image

when headers are supplied, they should only set the first tab, and not be used for new tabs apparently?

so we need to revert this for headers and do the same for query/defaultQuery. otherwise, it's a change in functionality and requires a new minor version

CC @dimaMachina who added tests for this expectation, what do you think?

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