mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-07 01:56:04 +00:00
* fix(studio): save retries, mutation queue circuit breaker, save_failure diagnostics Save failures could silently drop user work: code-editor saves fired a single PUT with no retry, DOM-edit failures drained the whole queue against a failing server, and several failure paths only logged to the console. - Retry code-editor saves with exponential backoff instead of dropping the edit on the first failed PUT. - Circuit breaker on the DOM-edit save queue: a failing server pauses the queue with a user-visible error state instead of burning every queued mutation against it. - save_failure events now carry error_message, status_code, and source on every emission path; style/attribute DOM-edit failures that previously only logged to the console now emit telemetry too. - Route unawaited commitMutation call sites (GSAP drag, property scrubbing, undo/redo, text fields) through a safe wrapper that reports failures via telemetry instead of unhandledrejection. Follow-ups (deferred): version/ETag conflict guard on file PUTs, offline save queue. * fix(studio): narrow save retry changes for fallow
20 lines
720 B
TypeScript
20 lines
720 B
TypeScript
import { useCallback } from "react";
|
|
import type { DomEditSelection } from "../components/editor/domEditing";
|
|
import { fetchParsedAnimations, getAnimationsForElement } from "./useGsapTweenCache";
|
|
|
|
export function useGsapAnimationFetchFallback(projectId: string | null, gsapSourceFile: string) {
|
|
return useCallback(
|
|
(selection: DomEditSelection) => async () => {
|
|
const pid = projectId;
|
|
if (!pid) return [];
|
|
const parsed = await fetchParsedAnimations(pid, gsapSourceFile);
|
|
if (!parsed) return [];
|
|
return getAnimationsForElement(parsed.animations, {
|
|
id: selection.id ?? null,
|
|
selector: selection.selector ?? null,
|
|
});
|
|
},
|
|
[projectId, gsapSourceFile],
|
|
);
|
|
}
|