@@ -2,8 +2,6 @@ import { useCallback, useRef } from "react";
22import { findUnsafeMutationValues } from "@hyperframes/core/studio-api/finite-mutation" ;
33import type { DomEditSelection } from "../components/editor/domEditingTypes" ;
44import { applySoftReload } from "../utils/gsapSoftReload" ;
5- import { resolveGsapFidelityArgs , runShadowGsapFidelity } from "../utils/sdkShadowGsapFidelity" ;
6- import { runShadowGsapKeyframeFidelity } from "../utils/sdkShadowGsapKeyframe" ;
75import { updateKeyframeCacheFromParsed } from "./gsapKeyframeCacheHelpers" ;
86import { createKeyedSerializer } from "./serializeByKey" ;
97import {
@@ -46,15 +44,12 @@ async function mutateGsapScript(
4644
4745// oxfmt-ignore
4846// fallow-ignore-next-line complexity
49- export function useGsapScriptCommits ( { projectIdRef, activeCompPath, previewIframeRef, editHistory, domEditSaveTimestampRef, reloadPreview, onCacheInvalidate, onFileContentChanged, showToast, sdkSession } : GsapScriptCommitsParams ) {
47+ export function useGsapScriptCommits ( { projectIdRef, activeCompPath, previewIframeRef, editHistory, domEditSaveTimestampRef, reloadPreview, onCacheInvalidate, onFileContentChanged, showToast } : GsapScriptCommitsParams ) {
5048 // Serializer for per-key commits (options.serializeKey). Keyed by
5149 // `gsap:${animationId}:meta`, it chains a meta commit onto the prior one for
52- // the same animationId so their POSTs can't interleave — which is what made
53- // the shadow fidelity diff pair an op with a stale server result and report
54- // false ease mismatches. Held in a ref so the chain survives re-renders.
50+ // the same animationId so their POSTs can't interleave. Held in a ref so the
51+ // chain survives re-renders.
5552 const serializerRef = useRef ( createKeyedSerializer ( ) ) ;
56- // Pre-existing complexity (server mutate + history + reload branches); this PR
57- // adds only a guarded shadow-fidelity dispatch.
5853 // fallow-ignore-next-line complexity
5954 const runCommit = useCallback ( async ( selection : DomEditSelection , mutation : Record < string , unknown > , options : CommitMutationOptions ) => {
6055 const pid = projectIdRef . current ;
@@ -76,28 +71,6 @@ export function useGsapScriptCommits({ projectIdRef, activeCompPath, previewIfra
7671 }
7772 if ( result . changed === false ) return ;
7873 domEditSaveTimestampRef . current = Date . now ( ) ;
79- // Shadow value fidelity: diff the SDK's GSAP writer output against the
80- // server's, from the same pre-op file. Fire-and-forget; server authoritative.
81- // Meta-level ops carry shadowGsapOp (add / update-meta / delete via
82- // useGsapAnimationOps); keyframe ops carry shadowKeyframeOp (add/remove via
83- // useGsapKeyframeOps, handled by the gsap_keyframe block below). Per-property
84- // handlers (useGsapPropertyDebounce) don't synthesize one yet — deferred follow-up.
85- // scriptText is null when the composition has no GSAP script; nothing to diff.
86- const fidelityArgs = resolveGsapFidelityArgs (
87- sdkSession ,
88- options . shadowGsapOp ,
89- result . before ,
90- result . scriptText ,
91- ) ;
92- if ( fidelityArgs ) {
93- void runShadowGsapFidelity ( fidelityArgs . before , fidelityArgs . op , fidelityArgs . serverScript ) ;
94- }
95- // Keyframe value fidelity (gsap_keyframe): same serialize-diff approach, but
96- // the SDK has no keyframe reader so there is no live-existence path — the diff
97- // is the only signal. Guarded on a live session + both scripts to diff.
98- if ( sdkSession && options . shadowKeyframeOp && result . before != null && result . scriptText != null ) {
99- void runShadowGsapKeyframeFidelity ( result . before , options . shadowKeyframeOp , result . scriptText ) ;
100- }
10174 if ( result . before != null && result . after != null ) {
10275 await editHistory . recordEdit ( { label : options . label , kind : "manual" , coalesceKey : options . coalesceKey , files : { [ targetPath ] : { before : result . before , after : result . after } } } ) ;
10376 }
@@ -111,12 +84,10 @@ export function useGsapScriptCommits({ projectIdRef, activeCompPath, previewIfra
11184 reloadPreview ( ) ;
11285 }
11386 onCacheInvalidate ( ) ;
114- } , [ projectIdRef , activeCompPath , previewIframeRef , editHistory , domEditSaveTimestampRef , reloadPreview , onCacheInvalidate , onFileContentChanged , showToast , sdkSession ] ) ;
87+ } , [ projectIdRef , activeCompPath , previewIframeRef , editHistory , domEditSaveTimestampRef , reloadPreview , onCacheInvalidate , onFileContentChanged , showToast ] ) ;
11588 // Every GSAP-script commit is a read-modify-write of one file. Overlapping
116- // commits to the SAME file (any op type, any animation) interleave server-side
117- // and make the shadow fidelity diff pair an op with a stale server result —
118- // the false ease/value mismatches this serializer exists to prevent. So
119- // serialize per target file by default; an explicit serializeKey overrides.
89+ // commits to the SAME file (any op type, any animation) interleave server-side,
90+ // so serialize per target file by default; an explicit serializeKey overrides.
12091 const commitMutation = useCallback (
12192 ( selection : DomEditSelection , mutation : Record < string , unknown > , options : CommitMutationOptions ) => {
12293 const file = selection . sourceFile || activeCompPath || "index.html" ;
@@ -128,7 +99,7 @@ export function useGsapScriptCommits({ projectIdRef, activeCompPath, previewIfra
12899 const trackGsapSaveFailure = useGsapSaveFailureTelemetry ( activeCompPath ) ;
129100 const commitMutationSafely = useSafeGsapCommitMutation ( commitMutation , trackGsapSaveFailure , showToast ) ;
130101 const propertyOps = useGsapPropertyDebounce ( commitMutationSafely ) ;
131- const animationOps = useGsapAnimationOps ( { projectIdRef, activeCompPath, commitMutation, commitMutationSafely, showToast, sdkSession } ) ;
102+ const animationOps = useGsapAnimationOps ( { projectIdRef, activeCompPath, commitMutation, commitMutationSafely, showToast } ) ;
132103 const keyframeOps = useGsapKeyframeOps ( { activeCompPath, commitMutation, commitMutationSafely, trackGsapSaveFailure } ) ;
133104 const arcPathOps = useGsapArcPathOps ( commitMutationSafely ) ;
134105 return { commitMutation, ...propertyOps , ...animationOps , ...keyframeOps , ...arcPathOps } ;
0 commit comments