fix(canvas): keep launch payload on first chat mount for auto-send
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled

This commit is contained in:
Your Name 2026-02-22 13:17:01 +08:00
parent 82e6f5e947
commit a9e601b2ac

View File

@ -1182,6 +1182,7 @@ export function CanvasChatPanel({ chatId, initialMessages = [], onClose, onOpenF
const autoContextRef = useRef<string | null>(null);
const pendingLaunchRef = useRef<CanvasLaunchPayload | null>(null);
const [launchAutoSendTick, setLaunchAutoSendTick] = useState(0);
const hasInitializedChatStateRef = useRef(false);
const sessionMenuRef = useRef<HTMLDivElement>(null);
const historyScrollTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
@ -2681,6 +2682,11 @@ export function CanvasChatPanel({ chatId, initialMessages = [], onClose, onOpenF
const hasHydratedHistoryRef = useRef(false);
useEffect(() => {
if (!hasInitializedChatStateRef.current) {
hasInitializedChatStateRef.current = true;
return;
}
loadedHistorySignatureRef.current = "";
processedMessageIds.current.clear();
hasHydratedHistoryRef.current = false;