fix(sidebar): fix rename input and prevent auto-namer overwrite#6
Open
mike-meow wants to merge 8 commits into
Open
fix(sidebar): fix rename input and prevent auto-namer overwrite#6mike-meow wants to merge 8 commits into
mike-meow wants to merge 8 commits into
Conversation
…tting Two bugs in sidebar session rename: 1. Double-click rename flashed away because onBlur fired before the useEffect could focus the input. Added a 200ms grace window after entering edit mode to ignore transient blur events. 2. Space key committed the rename because button keyup activation propagated from the input. Added onKeyUp stopPropagation on the rename input to prevent space from activating the parent button. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…and space key Two fixes for sidebar rename bugs: 1. Double-click rename auto-committed immediately because the first click's handleSelectSession fired focusComposer via double-rAF, which stole focus from the rename input after it mounted, triggering onBlur → confirmRename. Fixed by tracking editingSessionId in a ref and skipping focusComposer when a rename is active. 2. Space key committed the rename because keyup bubbled to the parent <button>, which the browser interpreted as a button activation click. Fixed by adding onKeyUp stopPropagation on the rename input. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
9b42a4a to
a09264b
Compare
…med sessions Add a persisted `userNamed` set to session-names store. When a user renames a session via PATCH /sessions/:id/name, the session is flagged as user-named. The auto-namer skips sessions with this flag, preserving manual renames. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
removeName() now also clears the userNamed flag, preventing stale entries from leaking into the persisted Set when sessions are deleted/archived. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The coverage gate runs on Node (not Bun), so Bun.write is undefined. Use writeFile from node:fs/promises instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The image thumb route uses Bun.file() internally, so tests that hit the actual route handler only work on Bun. Skip the describe block when Bun is not available (Node-based CI runners). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
Two related sidebar rename fixes:
Double-click rename flashes away — The first click's
handleSelectSession()scheduledfocusComposer()via a double-requestAnimationFrame. By the time the rename input mounted, the delayedfocusComposerstole focus →onBlur→ confirm → edit mode exited. Fix: AddededitingSessionIdRefand skipfocusComposerwhen a rename is active.Space key commits rename — Pressing space in the rename
<input>caused thekeyupevent to bubble to the parent<button>, which browsers treat as a click activation. Fix: AddedonKeyUphandler withstopPropagation().Auto-namer overwrites manual renames — After manually renaming, the next user message triggered the auto-namer which could overwrite the name. Fix: Added a persisted
userNamedflag insession-names.ts, set on PATCH rename, checked in auto-namer to skip.Files changed
web/src/components/Sidebar.tsx—editingSessionIdRef+ guard infocusComposerrAFweb/src/components/SessionItem.tsx—onKeyUpstopPropagation on rename inputweb/src/components/SessionItem.test.tsx— Updated blur testweb/server/session-names.ts—userNamedSet persistenceweb/server/routes/sessions.ts— SetuserNamedflag on PATCH renameweb/server/index.ts— Skip auto-namer for user-named sessionsweb/server/session-namer.test.ts— Tests foruserNamedflagTesting
bun run typecheck✅bun run test✅bun run format:check✅Review provenance
🤖 Generated with Claude Code