mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-10-30 09:16:55 +00:00
* fix(producer): cache the google fonts css lookup per process Studio compiles every composition in a project separately for its sidebar thumbnails and for gsap-animation extraction. Each compile called injectDeterministicFontFaces, which re-fetched the same font family's CSS metadata from fonts.googleapis.com over the network every single time -- only the woff2 binary files were cached to disk, not the CSS lookup itself. A project with a dozen small compositions and three declared font families fired dozens of redundant network round trips serially, holding the editor's asset-readiness overlay well past its own 8-second timeout. Adds an in-process cache for the CSS lookup keyed by the exact request URL, self-evicting on failure so a later call still retries. Measured on a real project: gsap-animation extraction across 12 compositions dropped from ~16.4s to ~2.9s wall time, and per-composition thumbnail generation dropped from 9-11s each to 10-14ms each once the cache is warm. * fix(producer): isolate the google fonts css cache from any one caller's abort An adversarial review of the process-wide CSS-lookup cache found two real bugs before it shipped. First, the cached promise carried whichever caller reached it first's AbortSignal, so one render's cancellation could fail a completely unrelated concurrent render sharing the same font family. Second, the cache has no reset between test files running in one process, so two sibling test suites asserting per-call fetch counts against the same Google Fonts URL silently saw each other's cached result. Strips the caller-specific AbortSignal from the shared fetch and races each caller's own signal against it independently, so a caller can still bail out on its own cancellation without affecting anyone else awaiting the same lookup. Clears the cache in the two sibling test files' own beforeEach. * fix(producer): key the google fonts css cache by fail-closed mode and drop transient statuses