fix(play): guard decode callback against stale img ref
Verify imgRef.current === el before firing onImageReady, so a late-resolving decode from a prior <img> element cannot trigger the gate prematurely. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -413,7 +413,8 @@ export function PlayCanvas({
|
||||
if (!onImageReady) return;
|
||||
const el = imgRef.current;
|
||||
if (!el) { onImageReady(); return; }
|
||||
el.decode().then(onImageReady, onImageReady);
|
||||
const notify = () => { if (imgRef.current === el) onImageReady(); };
|
||||
el.decode().then(notify, notify);
|
||||
}}
|
||||
className={`block select-none animate-fade-in transition-opacity duration-700 ease-out ${
|
||||
imageClickable ? "cursor-pointer" : interactive ? "cursor-default" : "cursor-wait"
|
||||
|
||||
Reference in New Issue
Block a user