Skip to content

fix: rename input pre-fills the session title and selects all text - #357

Open
windli2018 wants to merge 1 commit into
agegr:mainfrom
windli2018:feat/session-rename-fix
Open

fix: rename input pre-fills the session title and selects all text#357
windli2018 wants to merge 1 commit into
agegr:mainfrom
windli2018:feat/session-rename-fix

Conversation

@windli2018

Copy link
Copy Markdown

What

When renaming a session, the rename input now pre-fills the displayed title and selects all of it — so you can type a new name to replace it, or edit in place.

Why

Before, the input was pre-filled with session.name only. Sessions without an explicit name (most of them) have an empty session.name, so the input appeared blank — even though the sidebar displays a fallback title (first message / id). Also the pre-select ran via setTimeout(..., 0) before the input had mounted, so it often didn't select anything.

How

  • startRename fills session.name || firstMessage.slice(0,50) || id.slice(0,12) (the same fallback the row title uses).
  • Selection happens in a useEffect on renaming (after the input is mounted, via requestAnimationFrame).
  • commitRename no-ops when the value equals the displayed fallback title — so the fallback isn't accidentally persisted as a real name.

Validation

  • Rename on a session without a custom name → input shows the first-message title, fully selected.
  • Type to replace, or edit in place; unchanged submit doesn't persist the fallback as a name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant