fix(studio): scope timeline ease focus lifecycle (#2710)

This commit is contained in:
Miguel Ángel
2026-08-03 23:06:46 -07:00
committed by GitHub
parent 8c6cf90ff9
commit 0a70ba6717
28 changed files with 767 additions and 263 deletions
@@ -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],