Track the active object URL in previewUrlRef to ensure the cleanup effect revokes the correct URL on unmount, avoiding closure over stale state. When replacing or clearing preview, revoke the ref's current URL and set it to null. On unmount, revoke previewUrlRef.current if present. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>