fix: keep presentation deep links replay backed

This commit is contained in:
lda
2026-07-09 08:29:48 +07:00 Verified
parent 86832ab7ee
commit bee00a7a2f
7 changed files with 60 additions and 19 deletions
@@ -173,6 +173,16 @@ describe("PresentationRoute", () => {
expect(screen.getByLabelText("demo workflow stage")).toHaveAttribute("data-demo-layout", "approval");
});
it("renders replay-backed approval evidence on a direct approval hash", async () => {
window.location.hash = "#scene/interrupt-evidence/approval";
const { PresentationRoute } = await import("./PresentationRoute.js");
render(<PresentationRoute />);
expect(await screen.findByLabelText("typed interrupt contract")).toBeInTheDocument();
expect(screen.getByRole("group", { name: /issue review resume/i })).toBeInTheDocument();
expect(screen.getByText(/Recorded resume payload for this decision/i)).toBeInTheDocument();
});
it("chat run action advances the replay timeline when no live server is configured", async () => {
setReplayMode();
window.location.hash = "#scene/workflow-demo/operation";
@@ -91,19 +91,18 @@ export const PresentationRoute = () => {
}, []);
useEffect(() => {
if (demo.state.phase === "ready" && presentationTarget.mode === "replay" && demo.state.mode !== "replay") {
// Scene deep-links need the recorded demo state before the operator starts a live run.
// The chat action can still switch the shared timeline to live via start("live").
if (demo.state.phase === "ready" && demo.state.mode !== "replay") {
demo.setMode("replay");
}
if (demo.state.phase === "ready" && presentationTarget.mode === "live" && demo.state.mode !== "live") {
demo.setMode("live");
}
}, [demo.state.phase, demo.state.mode, demo.setMode, presentationTarget.mode]);
}, [demo.state.phase, demo.state.mode, demo.setMode]);
useEffect(() => {
if (presentationTarget.mode === "replay" && demo.state.phase === "ready" && demo.state.mode === "replay") {
demo.start();
if (demo.state.phase === "ready" && demo.state.mode === "replay") {
demo.start("replay");
}
}, [demo.state.phase, demo.state.mode, demo.start, presentationTarget.mode]);
}, [demo.state.phase, demo.state.mode, demo.start]);
useEffect(() => {
dispatch({ type: "set_playback_mode", mode: demo.state.mode });
@@ -143,4 +142,3 @@ export const PresentationRoute = () => {
</main>
);
};