fix(ide): derive saved-document name from operation and fix frozen tab title#3897
Merged
Conversation
…b title
Two related fixes to how the IDE derives titles from the GraphQL operation
when Smart Cache saved documents are available.
Save dialog: the first-save "Document name" field was hardcoded empty. It
now prefills from the operation name (matching the tab), e.g. saving
`query GetPosts { ... }` opens the modal pre-filled with "GetPosts".
Empty/unparseable queries leave the field blank so the placeholder shows.
Tab title: a temp draft froze its title to the first character of the op
name (e.g. "G" instead of "GetPosts") whenever a body brace already
followed the name being typed (autoclosed `{}`, or body typed first). The
sticky-title persist ran synchronously per keystroke for temp drafts, and
`deriveStableDocTitle` matched on the first character. Temp drafts no
longer persist a derived title — the tab already derives live from the
query while the title is auto, and the first explicit save sets a real
title. The settle-on-debounce freeze is preserved for real documents.
Tests: useAutoSave unit coverage for the regression, plus e2e coverage for
the tab title tracking the full op name and the SaveDialog name prefill.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Codify the testing policy in the root CLAUDE.md: every reproducible bug fix ships with a test that fails before the fix and passes after, and we reach for the broadest user-facing layer that can reproduce the bug first (e2e / Codeception functional/acceptance/integration) before dropping to a unit test. Unit tests remain valued, but in addition to — not instead of — the surface-level test, since the priority is proving the software works as a whole.
josephfusco
approved these changes
Jun 9, 2026
This was referenced Jun 9, 2026
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.
What & why
Two related fixes to how the IDE derives titles from the GraphQL operation when the Smart Cache saved-documents feature is available.
1. Save dialog prefills the Document Name from the operation
Clicking Save draft on a new draft opened the modal with an empty Document name field. It now prefills from the operation name — the same value the tab shows — so saving
query GetPosts { … }opens the modal pre-filled with GetPosts. Anonymous queries ({ posts { … } }) prefill the first field (posts), matching the tab. Empty/unparseable queries leave the field blank so thee.g. Recent Posts by Authorplaceholder still shows. The name remains editable before saving.2. Fix the frozen tab title ("G" instead of "GetPosts")
A temp draft could freeze its tab title to the first character of the operation name whenever a body brace already followed the name being typed — an autoclosed
{}, or the body typed before the name. The active tab derives its title live from the query only while the stored title is still auto; the autosave hook persisted a derived title synchronously on every keystroke for temp drafts, andderiveStableDocTitlematched on the first character (query G{→"G"), flipping the title out of the auto state and stranding the tab at "G".Temp drafts no longer persist a derived title — they're local-only, the tab already derives live from the query while the title is auto, and the first explicit save sets a real title. The settle-on-debounce title freeze is preserved for real (non-temp) documents, where the 2s debounce guarantees the op name has settled.
Scope note
This fixes new drafts going forward. A draft whose title was already frozen to a single character in a prior session keeps that persisted title until renamed.
Tests
useAutoSave.test.js): a temp draft does not persist a derived title mid-type (thequery G{}regression).tabs.spec.js): the tab title tracks the full op name when a body brace precedes the name — reproduces the exact freeze condition.save-flow.spec.js): the SaveDialog prefills the Document name from the operation.All 420 unit tests pass; both new e2e specs pass locally against wp-env (Smart Cache + IDE active).