fix(studio): a sealed preview's reload asks under one current frame token (#7862)

This commit is contained in:
Miguel Ángel
2026-11-15 20:22:28 +00:00
committed by GitHub
parent c030e3193d
commit 1f17b3dfeb
2 changed files with 7 additions and 1 deletions
@@ -218,6 +218,12 @@ describe("a host's sandbox origin", () => {
`/api/projects/demo/preview/~${token}/comp/scene.html`,
],
["/api/projects/demo/preview?_t=1", `/api/projects/demo/preview/~${token}?_t=1`],
// A reload starts from the frame's own src, which already carries a token, maybe a stale one.
[`/api/projects/demo/preview/~${token}?_t=2`, `/api/projects/demo/preview/~${token}?_t=2`],
[
`/api/projects/demo/preview/~${"S".repeat(43)}/comp/scene.html`,
`/api/projects/demo/preview/~${token}/comp/scene.html`,
],
])(
"seals an opaque preview of %s and loads it under its project's frame token",
async (directUrl, sealed) => {
+1 -1
View File
@@ -1,6 +1,6 @@
import { studioApiFetch } from "../../utils/studioApiFetch";
const PREVIEW_PATH = /^(\/api\/projects\/[^/?#]+)\/preview(?=[/?#]|$)/;
const PREVIEW_PATH = /^(\/api\/projects\/[^/?#]+)\/preview(?:\/~[\w-]{43})?(?=[/?#]|$)/;
export function fetchFrameToken(frameTokenPath: string): Promise<string | null> {
return studioApiFetch(frameTokenPath)