refactor: remove custom title generation and optimize session updates (#187)

* chore: bump version to 0.9.16

* Remove custom session title generation and rely on upstream OpenCode titles

- Delete backend/src/routes/title.ts and backend/src/services/session-title.ts
- Remove /api/generate-title route from backend/src/index.ts
- Delete backend/test/routes/title.test.ts
- Remove useTitleGenerating hook and title generation logic from frontend/src/hooks/useOpenCode.ts
- Remove generating prop from Header.EditableTitle and frontend/src/pages/SessionDetail.tsx
- Clean up unused imports in frontend/src/hooks/useOpenCode.ts and frontend/src/components/ui/header.tsx
- Session titles now come directly from upstream OpenCode via session refetches after prompt

* refactor: optimize session query updates with setQueryData

- Remove redundant query invalidations in useSendPrompt
- Use setQueryData for optimistic updates in SSE session.updated handler
- Update session cache directly when session exists in list
- Prepend new sessions to list when not found
- Fall back to invalidation only when cache is empty
This commit is contained in:
Chris Scott authored and GitHub committed 2026-04-16 09:59:35 -04:00
1 parent 6d961ccd72
commit 8e90ba2e6e
8 files changed
+40 -487

No files matched your search

+9 -17
View File
@@ -10,7 +10,7 @@ import { cn } from "@/lib/utils";
import type { ReactNode } from "react";
import { useState, useEffect } from "react";
import { useMobile } from "@/hooks/useMobile";
import { Loader2, X } from "lucide-react";
import { X } from "lucide-react";
import { usePermissions, useQuestions } from "@/contexts/EventContext";
interface HeaderProps {
@@ -62,11 +62,10 @@ interface HeaderEditableTitleProps {
value: string;
onChange: (value: string) => void;
subtitle?: React.ReactNode;
generating?: boolean;
className?: string;
}
function HeaderEditableTitle({ value, onChange, subtitle, generating, className }: HeaderEditableTitleProps) {
function HeaderEditableTitle({ value, onChange, subtitle, className }: HeaderEditableTitleProps) {
const [isEditing, setIsEditing] = useState(false);
const [editTitle, setEditTitle] = useState(value);
const isMobile = useMobile();
@@ -143,19 +142,12 @@ function HeaderEditableTitle({ value, onChange, subtitle, generating, className
</form>
) : (
<div className="min-w-0">
{generating ? (
<div className="flex items-center gap-2">
<Loader2 className="w-3 h-3 animate-spin text-muted-foreground" />
<span className="text-xs sm:text-base text-muted-foreground italic">Generating title...</span>
</div>
) : (
<h1
className="text-xs sm:text-base font-semibold bg-gradient-to-r from-foreground to-muted-foreground bg-clip-text text-transparent truncate cursor-pointer hover:opacity-80 transition-opacity"
onClick={handleTitleClick}
>
{value}
</h1>
)}
<h1
className="text-xs sm:text-base font-semibold bg-gradient-to-r from-foreground to-muted-foreground bg-clip-text text-transparent truncate cursor-pointer hover:opacity-80 transition-opacity"
onClick={handleTitleClick}
>
{value}
</h1>
{subtitle && (
<p className="text-[10px] sm:text-xs text-muted-foreground truncate">
{typeof subtitle === 'string' ? subtitle : subtitle}
@@ -254,4 +246,4 @@ export const Header = Object.assign(HeaderBase, {
Actions: typeof HeaderActions;
MobileDropdown: typeof HeaderMobileDropdown;
Settings: typeof HeaderSettingsButton;
};
};