You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.