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
In App.js, there's a potential issue with how downloads are processed. The current implementation uses a useEffect hook that depends on downloadStore.downloads.size, which could trigger multiple download attempts for the same file.
Any time downloads.size changes, the effect runs again and tries to start a download for every incomplete download. If multiple downloads are added at once, or if the download state changes during processing, this can lead to duplicate download attempts for the same file.
Suggested Solutions
Track active downloads with useRef:
Move download logic to the store:
Move the download management logic into the downloadStore itself, which can maintain an internal queue and ensure each download is processed exactly once.
This issue was identified during the migration from MobX to Zustand.
The text was updated successfully, but these errors were encountered:
Problem Description
In
App.js
, there's a potential issue with how downloads are processed. The current implementation uses auseEffect
hook that depends ondownloadStore.downloads.size
, which could trigger multiple download attempts for the same file.Any time
downloads.size
changes, the effect runs again and tries to start a download for every incomplete download. If multiple downloads are added at once, or if the download state changes during processing, this can lead to duplicate download attempts for the same file.Suggested Solutions
Track active downloads with useRef:
Move download logic to the store:
Move the download management logic into the
downloadStore
itself, which can maintain an internal queue and ensure each download is processed exactly once.This issue was identified during the migration from MobX to Zustand.
The text was updated successfully, but these errors were encountered: