mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-13 19:33:46 +00:00
23a184244c
The client runs babel-plugin-react-compiler in annotation mode, so 'use memo' is the opt in and the codebase already uses it in eighteen places. The teleprompter was the odd one out, hand rolling what the compiler does better. Teleprompter and ScriptBlock now carry the directive, which replaces two useMemo calls, four useCallback calls and a memo wrapper. Verified against the compiler rather than assumed: the two files emit 46 and 15 memo cache slots respectively, finer grained than the six the hand written version had. The scroll engine and the key handler deliberately keep no directive. They derive nothing and render nothing, they drive an animation frame loop through refs, so there is nothing to memoise and no reason to put them through the compiler. Also fixes a hazard the conversion surfaced. The follow effect listed the blocks array in its dependencies, but memoisation is a performance hint React is free to discard, under the compiler as much as by hand. A rebuilt but otherwise identical list would re-fire the jump to the loaded event and yank the script back mid read. It now watches whether the loaded event has a block at all, which is the condition it actually cared about and does not depend on identity. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cb8RVPNQ2ETPJxdy4b8CHf