Skip to content
Source
Sign inSign up
pingdotgg/t3code

Add project rename support in the sidebar #1798

Mergedjuliusmarmingemerged 1 commit intomain fromrefs/pull/1798/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 131 additions and 17 deletions (loading 1).

x
0 of 2 viewed, 2 left
131 additions and 17 deletionsapps/web/src/components/Sidebar.tsxModified
View file
@@ -267,8 +267,9 @@
renamingThreadId: ThreadId | null;
renamingTitle: string;
setRenamingTitle: (title: string) => void;
- renamingInputRef: MutableRefObject<HTMLInputElement | null>;
- renamingCommittedRef: MutableRefObject<boolean>;
+ onRenamingInputMount: (element: HTMLInputElement | null) => void;
+ hasRenameCommitted: () => boolean;
+ markRenameCommitted: () => void;
confirmingArchiveThreadId: ThreadId | null;
setConfirmingArchiveThreadId: Dispatch<SetStateAction<ThreadId | null>>;
confirmArchiveButtonRefs: MutableRefObject<Map<ThreadId, HTMLButtonElement>>;
@@ -400,13 +401,7 @@
{threadStatus && <ThreadStatusLabel status={threadStatus} />}
{props.renamingThreadId === thread.id ? (
<input
- ref={(element) => {
- if (element && props.renamingInputRef.current !== element) {
- props.renamingInputRef.current = element;
- element.focus();
- element.select();
- }
- }}
+ ref={props.onRenamingInputMount}
className="min-w-0 flex-1 truncate text-xs bg-transparent outline-none border border-ring rounded px-0.5"
value={props.renamingTitle}
onChange={(event) => props.setRenamingTitle(event.target.value)}
@@ -414,16 +409,16 @@