Comfy-Org / Comfy-Org/ComfyUI_frontend
Media3DTop: Guard against concurrent loadThumbnail() races on src change
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 699
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 490
Description
## Summary
In `src/platform/assets/components/Media3DTop.vue`, the `watch(asset.src)` handler resets `hasAttempted = false` and calls `revokeThumbnail()` while a previous `loadThumbnail()` invocation may still be in-flight. If the `IntersectionObserver` fires again immediately after the reset, two concurrent thumbnail loads can race, potentially resulting in stale blob URLs or duplicate render/upload calls.
## Suggested Approach
Adopt the existing `useCachedRequest` composable (located at `src/composables/useCachedRequest.ts`), which wraps fetch functions with `AbortController` support and deduplication. This would allow proper cancellation of any in-flight model download or render when `asset.src` changes.
Alternatively, a simpler in-component guard (e.g., tracking an `AbortController` ref and aborting on src change) could be used if the full composable is overkill.
## References
- PR: https://github.com/Comfy-Org/ComfyUI_frontend/pull/9471
- Review comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/9471#discussion_r2938399192
Raised by: @christian-byrne
┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-10035-Media3DTop-Guard-against-concurrent-loadThumbnail-races-on-src-change-3256d73d36508180a9aeec20037e99d1) by [Unito](https://www.unito.io)
Contributor guide
Assessment
This issue has not been assessed yet.