Skip to content

Commit 0701234

Browse files
fix(studio): wire onTrySdkPersist to sdkCutoverPersist (cutover was unwired)
Stage 7 s7.5 removed the feature flag and declared cutover 'always-on', but onTrySdkPersist was never actually passed to useDomEditCommits — the sdkCutoverPersist function was dead code in production. Thread sdkSession through useDomEditSession params, build the onTrySdkPersist closure there (all CutoverDeps are already in scope), and pass sdkSession from App.tsx. Style/text/attribute/html-attribute commits now route through SDK dispatch instead of the server patch path. Co-authored-by: Miguel Ángel <miguel07alm@protonmail.com>
1 parent a37b6ff commit 0701234

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

packages/studio/src/App.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ export function StudioApp() {
303303
openSourceForSelection: fileManager.openSourceForSelection,
304304
selectSidebarTab: selectSidebarTabStable,
305305
getSidebarTab: getSidebarTabStable,
306+
sdkSession,
306307
});
307308
domEditSelectionBridgeRef.current = domEditSession.domEditSelection;
308309
clearDomSelectionRef.current = domEditSession.clearDomSelection;

packages/studio/src/hooks/useDomEditSession.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import type { EditHistoryKind } from "../utils/editHistory";
44
import type { RightPanelTab } from "../utils/studioHelpers";
55
import type { PatchTarget } from "../utils/sourcePatcher";
66
import type { SidebarTab } from "../components/sidebar/LeftSidebar";
7+
import type { Composition } from "@hyperframes/sdk";
8+
import { sdkCutoverPersist } from "../utils/sdkCutover";
79
import { useAskAgentModal } from "./useAskAgentModal";
810
import { useDomSelection } from "./useDomSelection";
911
import { usePreviewInteraction } from "./usePreviewInteraction";
@@ -58,6 +60,7 @@ export interface UseDomEditSessionParams {
5860
openSourceForSelection?: (sourceFile: string, target: PatchTarget) => void;
5961
selectSidebarTab?: (tab: SidebarTab) => void;
6062
getSidebarTab?: () => SidebarTab;
63+
sdkSession?: Composition | null;
6164
}
6265

6366
// ── Hook ──
@@ -96,6 +99,7 @@ export function useDomEditSession({
9699
openSourceForSelection,
97100
selectSidebarTab,
98101
getSidebarTab,
102+
sdkSession,
99103
}: UseDomEditSessionParams) {
100104
void _setRefreshKey;
101105
void _readProjectFile;
@@ -229,6 +233,15 @@ export function useDomEditSession({
229233
clearDomSelection,
230234
refreshDomEditSelectionFromPreview,
231235
buildDomSelectionFromTarget,
236+
onTrySdkPersist: sdkSession
237+
? (selection, operations, originalContent, targetPath) =>
238+
sdkCutoverPersist(selection, operations, originalContent, targetPath, sdkSession, {
239+
editHistory,
240+
writeProjectFile,
241+
reloadPreview,
242+
domEditSaveTimestampRef,
243+
})
244+
: undefined,
232245
});
233246

234247
// ── Wiring: selection sync, GSAP cache, preview sync, selection handlers ──

0 commit comments

Comments
 (0)