mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-11 23:00:03 +00:00
fix(studio): scope timeline ease focus lifecycle (#2710)
This commit is contained in:
@@ -15,7 +15,11 @@ import {
|
||||
} from "../utils/sdkCutover";
|
||||
import type { KeyframeCacheEntry } from "../player/store/playerStore";
|
||||
import { commitKeyframeAtTimeImpl } from "./gsapKeyframeCommit";
|
||||
import { readKeyframeSnapshot, writeKeyframeCache } from "./gsapKeyframeCacheHelpers";
|
||||
import {
|
||||
clearKeyframeCacheForElement,
|
||||
readKeyframeSnapshot,
|
||||
writeKeyframeCache,
|
||||
} from "./gsapKeyframeCacheHelpers";
|
||||
import type {
|
||||
CommitMutation,
|
||||
CommitMutationOptions,
|
||||
@@ -331,6 +335,9 @@ export function useGsapKeyframeOps({
|
||||
const removeAllKeyframes = useCallback(
|
||||
async (selection: DomEditSelection, animationId: string) => {
|
||||
const targetPath = selection.sourceFile || activeCompPath || "index.html";
|
||||
// A class/descendant selector can resolve a live element whose selection
|
||||
// deliberately has no id. The cache is still keyed by that DOM id.
|
||||
const cacheElementId = selection.id || selection.element?.id;
|
||||
if (sdkSession && sdkDeps) {
|
||||
const handled = await sdkGsapRemoveAllKeyframesPersist(
|
||||
targetPath,
|
||||
@@ -339,12 +346,26 @@ export function useGsapKeyframeOps({
|
||||
sdkDeps,
|
||||
{ label: "Remove all keyframes" },
|
||||
);
|
||||
if (cutoverCommittedOrThrow(handled)) return;
|
||||
if (cutoverCommittedOrThrow(handled)) {
|
||||
if (cacheElementId) clearKeyframeCacheForElement(targetPath, cacheElementId);
|
||||
return;
|
||||
}
|
||||
}
|
||||
await commitMutationSafely(
|
||||
selection,
|
||||
{ type: "remove-all-keyframes", animationId },
|
||||
{ label: "Remove all keyframes", softReload: true },
|
||||
{
|
||||
label: "Remove all keyframes",
|
||||
softReload: true,
|
||||
// The committed result is the single success boundary: clearing
|
||||
// before it makes failed saves lie, while waiting for the reload leaves
|
||||
// stale diamonds visible during the source round-trip.
|
||||
onResult: (result) => {
|
||||
if (result.changed !== false && cacheElementId) {
|
||||
clearKeyframeCacheForElement(targetPath, cacheElementId);
|
||||
}
|
||||
},
|
||||
},
|
||||
);
|
||||
},
|
||||
[commitMutationSafely, activeCompPath, sdkSession, sdkDeps],
|
||||
|
||||
Reference in New Issue
Block a user