Repository navigation
Refactor editor header file rename to breadcrumb morph UI - #21265
Conversation
|
Understand this PR’s impact Explore downstream dependencies and potential security impact with Blast Radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe rename editor now uses a native full-name input. It preserves extensions, handles IME composition, supports blur and keyboard actions, and cancels when the active file changes. Tests cover these behaviors. Three unrelated files receive formatting-only changes. Priority: ⬇️ Low 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the problem, solution, rationale, and tests, but required information is missing. The Linked Issue section has no issue reference, Visual Proof does not include before-and-after attachments or the required N/A statement, and the Agent skill upstream boundary and Review sections are absent. Manual testing and the validation command checklist are also incomplete. Resolution Add a valid issue reference after
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: b9d8a050-58ae-4b70-9fe1-03238de53469
📒 Files selected for processing (4)
src/renderer/src/components/editor/EditorPanelHeaderPath.test.tsxsrc/renderer/src/components/editor/EditorPanelHeaderPath.tsxsrc/renderer/src/components/editor/editor-header-file-rename.tssrc/renderer/src/components/tab-bar/EditorFileTab.tsx
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
There was a problem hiding this comment.
Important
Two CI gates fail on this branch — the localization catalog/extraction checks reject the two new translate keys, and the changed-code quality gate reports 8 <Input> restyle findings on the touched tab-rename line. There is also a UI/behavior mismatch in the pinned-extension logic worth settling before merge.
Reviewed changes
- Breadcrumb morph rename strip (
EditorPanelHeaderPath.tsx) — rename mode now renders directory crumbs, a basename-only<input>, a static extension suffix, and Check/X buttons in place of the single full-nameInput. Blur-commit is retained; the buttonspreventDefaultonmousedownso a click does not blur-commit first. - Rename state/helpers (
editor-header-file-rename.ts) — addscurrentBaseName,currentExtension,breadcrumbSegments, and the exportedresolveRenameTarget()that re-attaches or respects the extension; selection logic simplifies toel.select(). - Tab-strip rename width (
EditorFileTab.tsx) — inline tab rename field grows from12ch/132px to18ch/200px. - Tests (
EditorPanelHeaderPath.test.tsx) — 10 new cases covering crumbs, extension handling, confirm/cancel, Escape, empty input, and extensionless files; all pass locally (typecheck andoxlintare clean too).
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Important
Switching files mid-rename does not fully cancel: the new active-file branch clears isRenaming but leaves the cancel guard unset, so the trailing blur can commit the typed value against the file that was being renamed. One-line fix inline.
Reviewed changes
- Breadcrumb morph replaced by a plain inline field —
EditorPanelHeaderPath.tsxnow renders one full-width native<input>holding the whole filename; the directory crumbs, the pinned-extension suffix, and the Check/X buttons are gone. It commits on Enter or blur and cancels on Escape. - CJK IME guard added — reuses
isImeCompositionKeyDownso an Enter that only confirms a composition candidate does not commit. - Active-file tracking added —
editor-header-file-rename.tskeeps the file path in state and drops rename mode when the editor switches files. - Cancel guard added —
renameCancelledRefswallows the trailing blur emitted when the input unmounts after Escape or commit. - Extension pinning and breadcrumb helpers removed —
resolveRenameTarget/getTypedExtension/getBreadcrumbSegmentsand the two addedconfirmRename/cancelRenamekeys are gone; theEditorFileTab.tsxwidth tweak is reverted. - Unrelated formatter churn —
AGENTS.md,docs/reference/remote-wire-compatibility.md, andusage-scan-worker-event-loop.test.tspicked up formatter-only edits.
ℹ️ Nitpicks
- The PR title/body still describe the breadcrumb strip, pinned extension, and Check/X buttons removed in
a594cfb, and claim 11 tests where the file has 10. Update the description to match the shipped inline field. - The formatter-only edits to
AGENTS.md:75,docs/reference/remote-wire-compatibility.md:105, andusage-scan-worker-event-loop.test.ts:36are unrelated to the rename and add review noise; consider reverting them.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 06e527d7-7ce5-4987-ad4a-51355ac34058
📒 Files selected for processing (2)
src/renderer/src/components/editor/EditorPanelHeaderPath.test.tsxsrc/renderer/src/components/editor/editor-header-file-rename.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
There was a problem hiding this comment.
ℹ️ No critical issues — the file-switch cancel guard is correct; one minor test-sensitivity note inline.
Reviewed changes
This run re-reviewed the single commit pushed since the prior pullfrog review (a594cfb).
- File-switch cancel guard (
editor-header-file-rename.ts) — the active-file-change branch now setsrenameCancelledRef.current = truebefore clearingisRenaming, so the trailing blur emitted when the rename input unmounts can no longer commit the typed name against the previous file. - File-switch test extended (
EditorPanelHeaderPath.test.tsx) — dispatches the trailing blur and asserts no rename is requested.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
- Display full breadcrumb (repo name + parent dirs) during rename for context - Separate basename field from extension suffix to clarify what users edit - Replace blur-to-commit with explicit confirm/cancel buttons - Auto-attach extension to basename; respect explicitly typed extensions - Add comprehensive tests for rename scenarios and edge cases
- Blur no longer commits, preventing accidental renames when focus moves - IME composition keys properly handled for CJK input support - File switches during rename now cancel the operation - Extension display improved to show final filename - Comprehensive test coverage added for edge cases
Replaces breadcrumb-morph rename with confirm/cancel buttons with a simple inline field accepting full filenames. Commits on Enter, blur, or Escape to cancel, matching tab bar and file explorer behavior. Adds renameCancelledRef to prevent blur-commit after Escape. Removes unused i18n strings for buttons and simplifies state by dropping extension pinning and breadcrumb display.
When switching files mid-rename, React may deliver the old input's blur event after the new file renders, causing a stale rename commit. Mark the rename as cancelled when the active file changes, and add test coverage verifying stale blur events are ignored.
Move blur-commit-after-file-change test from EditorPanelHeaderPath integration tests to useEditorHeaderFileRename unit test. Tests the blur-handling logic at the hook level where it belongs.
c3f0f84 to
22a3705
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run re-reviewed the one commit pushed since the prior pullfrog review (c3f0f84).
- Blur-race test moved to the hook — the file-switch DOM test's
fireEvent.blur(input)was dropped (it dispatched on an already-unmounted node, so it could not fail), andeditor-header-file-rename.test.tsnow drivesuseEditorHeaderFileRenamedirectly: open rename, seed the input ref, rerender with a new active file, then callcommitRename()and assert no rename is requested. - No production changes — the commit is test-only; the shipped inline field and its file-switch cancel guard are unchanged.
I verified the new test is a real guard: removing renameCancelledRef.current = true from the active-file branch makes it fail with renameFileOnDisk called against the newly active file (oldPath: /repo/other.md), so it now exercises the fix at the level where the race lives. Both rename suites pass (11 tests) and pnpm run typecheck:web is clean.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Problem
The file rename input in the editor header was just a text field with no context—you couldn't see which folder you were renaming the file in, the file extension could be accidentally deleted, and the field capped at 520px, which broke for deep directory structures.
Solution
When you open rename mode, the header morphs into a breadcrumb strip showing the full directory path (worktree name + parent folders) as read-only, with only the filename basename editable. The extension is pinned as a suffix and auto-reattached if you type a bare name; if you explicitly type an extension (same or different), it's respected. Added confirm and cancel buttons (Check/X icons) so the rename completes on button click instead of relying on blur focus loss. The morph field now claims full header width instead of capping at 520px.
ELI5
Renaming a file now shows you where it is, protects the file type, and gives you explicit confirm/cancel buttons.
What Changed
getBreadcrumbSegments()to build path context; addedresolveRenameTarget()to reattach extension or respect explicitly typed ones; exported both for testing.Why
Breadcrumb context prevents accidental renames in the wrong folder, pinned extension prevents silent type loss, explicit confirm/cancel is clearer than blur-based commits, and full width scales to any depth.
Visual Proof
Rename field morphs from a simple text input to a breadcrumb strip:
repo / docs / marketing /| basename-input |.mdwith confirm/cancel buttons.Testing
Notes
No breaking changes. Rename behavior and file-on-disk result are unchanged; only the UI presentation and interaction model improved.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)