Files
learnharness/app/chat/[id]/page.tsx
T
Amos d1d28d6bb4 Session switch: land at the bottom instantly with the question dock open
- Chat now remounts per session (key={chat.id}): fresh StickToBottom,
  fresh DockOverlay (no cross-session morph from the previous shell
  height), fresh useChat.
- Conversation initial="instant" (was "smooth"): the mount scroll to
  bottom is a jump, not a slide.
- DockOverlay skips the pending-question scroll/expand effect for the
  session's INITIAL pending question (dock starts expanded; the initial
  scroll positions us) — previously it fired a second smooth
  scrollToBottom right after the library's initial scroll (the visible
  'pause, then the quiz pops and pushes everything up').
- The dock-variant fade/rise no longer plays for the session's opening
  variant; reserved for mid-session transitions.
Verified live: client-side switch settles at d=1px from the bottom within
one frame of content swap, dock open from the first frame, both
directions (quiz session, plain session).
2026-08-22 06:45:32 +03:00

28 lines
686 B
TypeScript

import { notFound } from "next/navigation";
import { Chat } from "@/components/chat";
import { getChat } from "@/src/store/chats";
import type { TeacherUIMessage } from "@/src/agent/ui-message";
export const dynamic = "force-dynamic";
export default async function ChatPage({
params,
searchParams,
}: {
params: Promise<{ id: string }>;
searchParams: Promise<{ prompt?: string }>;
}) {
const [{ id }, { prompt }] = await Promise.all([params, searchParams]);
const chat = getChat(id);
if (!chat) notFound();
return (
<Chat
key={chat.id}
chatId={chat.id}
title={chat.title}
initialMessages={chat.messages as TeacherUIMessage[]}
initialPrompt={prompt}
/>
);
}