refactor: improve team management, OKRs, and session components
This commit is contained in:
@@ -9,19 +9,17 @@ interface EditableTitleProps {
|
||||
onUpdate: (sessionId: string, title: string) => Promise<{ success: boolean; error?: string }>;
|
||||
}
|
||||
|
||||
export function EditableTitle({
|
||||
sessionId,
|
||||
initialTitle,
|
||||
canEdit,
|
||||
onUpdate,
|
||||
}: EditableTitleProps) {
|
||||
export function EditableTitle({ sessionId, initialTitle, canEdit, onUpdate }: EditableTitleProps) {
|
||||
const [isEditing, setIsEditing] = useState(false);
|
||||
const [editingTitle, setEditingTitle] = useState('');
|
||||
const [isPending, startTransition] = useTransition();
|
||||
const inputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
// Use editingTitle when editing, otherwise use initialTitle (synced from SSE)
|
||||
const title = useMemo(() => (isEditing ? editingTitle : initialTitle), [isEditing, editingTitle, initialTitle]);
|
||||
const title = useMemo(
|
||||
() => (isEditing ? editingTitle : initialTitle),
|
||||
[isEditing, editingTitle, initialTitle]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (isEditing && inputRef.current) {
|
||||
@@ -110,4 +108,3 @@ export function EditableTitle({
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user