Skip to content

v0.1.2

Choose a tag to compare

@Denjino Denjino released this 20 May 17:22
· 9 commits to claude/build-horizon-view-v1-wstzS since this release
83b60e8
Fix CameraPreview.ready never resolving after a parent re-render

The original built the readiness Promise with `useRef(new Promise(...))`
and stashed the resolver in a *separate* ref captured inside the
constructor. The constructor expression ran on every render and
overwrote the resolver, while useRef stuck with the very first promise.
So once anything in the parent (e.g. setInitStatus during calibration
boot) triggered a re-render between mount and the webcam coming up,
the resolver that fired was attached to a brand-new throwaway promise,
and the one the caller was awaiting stayed pending forever — which
manifested as calibration stuck on "Starting webcam…" even though the
stream itself was visibly playing in the corner.

Pair the promise and its resolver in a single lazily-initialized ref
so they can't drift, and mark `resolved` so a future re-fire (e.g.
deviceId change re-running the effect) is a no-op rather than calling
a stale resolver.