Refresh project chat page on conversation updates

This commit is contained in:
kris
2026-04-07 17:09:58 +08:00
parent 4f59d59014
commit 1de9ae0492
2 changed files with 27 additions and 1 deletions

View File

@@ -44,7 +44,13 @@ export default async function ProjectChatPage({
return (
<AppShell bottomNav={false}>
<RealtimeRefresh
events={["project.messages.updated", "app.logs.updated", "project.context_risk.updated", "ota.updated"]}
events={[
"conversation.updated",
"project.messages.updated",
"app.logs.updated",
"project.context_risk.updated",
"ota.updated",
]}
/>
<StatusBar />
<PageNav

View File

@@ -0,0 +1,20 @@
import test from "node:test";
import assert from "node:assert/strict";
import path from "node:path";
import { readFile } from "node:fs/promises";
import { fileURLToPath } from "node:url";
const testsDir = path.dirname(fileURLToPath(import.meta.url));
const projectChatPagePath = path.join(testsDir, "../src/app/conversations/[projectId]/page.tsx");
test("project chat page listens to conversation updates for realtime refresh", async () => {
const source = await readFile(projectChatPagePath, "utf8");
const realtimeRefreshConfig = source.match(/<RealtimeRefresh[\s\S]*?events=\{\[([\s\S]*?)\]\}/);
assert.ok(realtimeRefreshConfig, "expected project chat page to declare RealtimeRefresh events");
assert.match(
realtimeRefreshConfig[1],
/"conversation\.updated"/,
"expected project chat page to refresh when conversation.updated is emitted",
);
});