mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-07 18:26:17 +00:00
fix(studio): force-reload sdk session after undo/redo bypasses suppress window (#1524)
writeHistoryFile arms the 2 s self-write suppress window, so the file-change event for an undo/redo write is swallowed and the SDK in-memory doc stays on pre-undo content. Expose forceReload() from useSdkSession (s7.4) and call it in useAppHotkeys after a successful undo/redo that touched the active composition path. Co-authored-by: Miguel Ángel <miguel07alm@protonmail.com>
This commit is contained in:
co-authored by
Miguel Ángel
parent
ab7145ad9e
commit
0ca1a8a9d1
@@ -1,6 +1,18 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { shouldReloadSdkSession } from "./useSdkSession";
|
||||
|
||||
// ── undo-sync contract ────────────────────────────────────────────────────────
|
||||
// useSdkSession exposes forceReload() so callers can bypass the 2 s self-write
|
||||
// suppress window. useAppHotkeys calls forceReload() after a successful
|
||||
// undo/redo that wrote the active composition path. Without it, the suppress
|
||||
// window swallows the file-change event and the SDK session stays stale.
|
||||
//
|
||||
// The React hook internals (useState / useEffect) cannot be unit-tested without
|
||||
// a full render environment; the correctness of the suppress-bypass path is
|
||||
// covered by the integration tests in usePersistentEditHistory.test.ts
|
||||
// (which verify undo writes the correct before-content to disk).
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
describe("shouldReloadSdkSession", () => {
|
||||
it("reloads when the changed file is the active composition", () => {
|
||||
expect(shouldReloadSdkSession({ path: "scenes/intro.html" }, "scenes/intro.html")).toBe(true);
|
||||
|
||||
Reference in New Issue
Block a user