graphiql icon indicating copy to clipboard operation
graphiql copied to clipboard

[graphiql v4] Allow reassign tab name

Open dimaMachina opened this issue 1 year ago • 3 comments

fixes https://github.com/graphql/graphiql/issues/3608

TODO:

  • [ ] add cypress tests
  • [ ] disallow updating tab.title if it was reassigned
  • [ ] move new component input to @graphiql/react

Preview

dimaMachina avatar Aug 24 '24 20:08 dimaMachina

🦋 Changeset detected

Latest commit: 4ed7cda202c6807612264717660388c7a0c37fa4

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

This PR includes changesets to release 1 package
Name Type
graphiql Minor

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

changeset-bot[bot] avatar Aug 24 '24 20:08 changeset-bot[bot]

Codecov Report

Attention: Patch coverage is 25.00000% with 12 lines in your changes missing coverage. Please review.

Project coverage is 65.19%. Comparing base (068e23c) to head (4ed7cda).

Files with missing lines Patch % Lines
packages/graphiql/src/components/GraphiQL.tsx 25.00% 12 Missing :warning:
Additional details and impacted files

Impacted file tree graph

@@               Coverage Diff               @@
##           graphiql-v4    #3753      +/-   ##
===============================================
- Coverage        65.30%   65.19%   -0.12%     
===============================================
  Files              121      121              
  Lines             7006     7021      +15     
  Branches          2263     2265       +2     
===============================================
+ Hits              4575     4577       +2     
- Misses            2414     2427      +13     
  Partials            17       17              
Files with missing lines Coverage Δ
packages/graphiql/src/components/GraphiQL.tsx 75.00% <25.00%> (-3.55%) :arrow_down:

... and 1 file with indirect coverage changes

codecov[bot] avatar Aug 24 '24 20:08 codecov[bot]

I see it's still WIP so maybe persistence is already planned, i think we should provide hooks for handling and setting tab name (so for example explorer could change the tab name), but i want to improve the hooks design. we already provide hooks for controlling tabs. we should provide tabs for reading and controlling tab state, including tab name. ideally we could combine some of this into something like useTabState(), perhaps this can be the beginning of that? this is also important for projects that need to persist the full editor state remotely via the storage API override, so either way it's ideal to persist this state and perhaps make it manageable via context

there was something else I wanted to reccomend here but i forgot, I'll come back to this, but thanks for all the initiative!

acao avatar Aug 24 '24 23:08 acao