v6: Promote variables/headers footer into a tab strip#4337
Draft
trevor-scheer wants to merge 5 commits into
Draft
v6: Promote variables/headers footer into a tab strip#4337trevor-scheer wants to merge 5 commits into
trevor-scheer wants to merge 5 commits into
Conversation
Replaces the old toggle UI below the query editor with `VarHeadersStrip`, a segmented control with Variables and Headers tabs. The Variables tab shows an inline hint with the variable count and JSON validity status. The previous `.graphiql-editor-tool` DOM structure is replaced; only CSS variable names remain part of the public API.
🦋 Changeset detectedLatest commit: 58f3c91 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
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 |
- Remove stale `'snippets'` guard from `getInitialVarTab()` — not a valid `VarTab` since the type was narrowed to `'variables' | 'headers'` - Restore `defaultEditorToolsVisibility="variables"|"headers"` behaviour via `useLayoutEffect` + `setVarTab` in `GraphiQLInterface` - Update `GraphiQL.spec.tsx` to query the new `[aria-label="Variables and Headers"]` section and the radio inputs instead of the old per-tab section labels - Clear localStorage in Cypress `beforeEach` so `varTab` (now persisted to storage) doesn't bleed between specs - Fix `commands.ts` headers editor selector: after the tab switch, only one editor is in the DOM so use `.eq(0)` instead of `.eq(1)` - Fix `tabs.cy.ts` headers textarea selector for the same reason - Fix `graphql-ws.cy.ts` Monaco editor count: now 3 (query + variables/headers (one at a time) + response) instead of 4 - Format with `oxfmt`
…sStrip - Don't dispose Monaco models on editor unmount in `VariablesEditor` and `RequestHeadersEditor` — models persist across var/headers tab switches so content is preserved when the editor remounts - Null-guard `editor.getModel()` in `useChangeHandler` before calling `onDidChangeContent` (disposed editors return null from `getModel()`) - Fall back to direct Monaco model API in `setEditorValues` and `synchronizeActiveTabValues` when the editor is disposed (e.g. when varTab='headers' and the variables editor is unmounted) - Guard `prettifyEditors` against disposed editors with `getModel()` check - Fix `.graphiql-editor-tool` CSS to be a flex column so `VarHeadersStrip`'s `flex: 1` actually fills the container — previously the editor had 0 height which caused Monaco to render 0 lines (no squiggly decorations, no content)
The deprecated-arguments test was racing against the 200ms debounced search:
`useState(() => getSearchResults(''))` initializes with all ~104 schema
entities when the schema is already loaded. `cy.dataCy('doc-explorer-option').first()`
grabbed the wrong entry before the debounce could narrow to the 1 correct result.
Fix: add `.should('have.length', 1)` between `.type('hasArgs')` and
`.first().children().first().click()` so Cypress retries until the debounce fires.
Also narrow `cy.clearLocalStorage()` to `cy.clearLocalStorage(/^graphiql:varTab$/)` so
only the varTab key is cleared between tests — the stated intent — rather than all localStorage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The variables/headers footer below the operation editor is replaced by a
VarHeadersStripcomponent with two tabs: Variables and Headers. The existing JSON editors are reused under their respective tabs. A right-aligned validity hint on the Variables tab shows how many variables are defined and whether they parse as valid JSON.Test plan
Refs: #4219