Skip to content

Commit d4b9bfd

Browse files
committed
fix(viewer): preserve archive bootstrap precedence
1 parent 748f90a commit d4b9bfd

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎e2e/embed-archive.spec.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const embedHtml = `<!doctype html>
1717
<body><div id="m"></div>
1818
<script type="module">
1919
import { mountViewer } from "/__embed/engine.js";
20-
let route = { archives: true };
20+
let route = { archives: true, surfaceId: "stale-post-id" };
2121
const subscribers = new Set();
2222
window.__archiveRoute = (next) => {
2323
route = next;

‎viewer/src/state.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,9 @@ function syntheticSession(id: string): SessionRow {
215215
// user lands somewhere usable rather than a blank page.
216216
export async function bootstrap() {
217217
const route = host().router.get();
218-
if (route.surfaceId && !route.sessionId) {
218+
// Keep archive precedence consistent with applyRoute() and the default
219+
// router: an embedding host may leave a stale surfaceId on its archive route.
220+
if (!route.archives && route.surfaceId && !route.sessionId) {
219221
await enterStandalone(route.surfaceId);
220222
if (standalonePost()) return;
221223
}

0 commit comments

Comments
 (0)