#3341
Delete dialog checks cross-seeds only for the loaded rows when all torrents are selected
This was generated by AI during a stress test.
Agent Brief
Category: bug Summary: With all 50,000 torrents selected, the Delete dialog says "Delete 50000 torrent(s)?", but the cross-seed check covers only the 300 loaded rows. The check sends one request at a time and keeps going after Cancel.
Current behavior: Test setup: qui develop 0e9989cc, 50,000 torrents, desktop table.
- The user selects all rows with the header checkbox and opens the Delete dialog. The check shows "Checking for cross-seeds (0/300)".
useCrossSeedWarningloops over thetorrentsit gets and awaitsgetLocalCrossSeedMatchesfor each one in turn. In select-all mode it gets only the loaded rows.- The first request took 8.3 s, the next ones about 250 ms each. 300 rows took about 95 s.
- After Cancel, the requests kept going until all 300 were done.
- A user who deletes with files can think that all 50,000 torrents were checked.
Desired behavior:
In select-all mode, the check covers every selected torrent. The frontend sends one bulk request for all selected torrents (the same selectAll, filters, search and excluded hashes as the delete), and the backend finds the cross-seeds. The check stops when the dialog closes.
Key interfaces:
useCrossSeedWarning: gets only the loaded rows in select-all mode, runs the checks one after another, and has no abort.api.getLocalCrossSeedMatches: one request per torrent. Each request looks up its torrent with a filter by hash, which visits the full library (autobrr/go-qbittorrent#167). It needs a bulk endpoint that takes the select-all payload, so the frontend does not send 50,000 requests.
Acceptance criteria:
- In select-all mode, the check covers every selected torrent, also the rows that are not loaded.
- One check of 50,000 selected torrents sends one bulk request, not one request per torrent.
- Closing or cancelling the dialog stops the requests that have not started.
- A hook test covers select-all with more torrents than the loaded rows.
- A hook test shows that unmount stops the loop.
Out of scope:
- "Also delete these cross-seeded torrents" in select-all mode (#3143, fixed by open PR #3170). This issue is blocked by #3143: after this change the warning finds cross-seeds outside the loaded rows, so the cross-seed delete of #3170 must not delete a torrent that the select-all delete already removes.
- How cross-seed matches are found.
Domain:
- Glossary terms: none used.
- ADRs: None.
- Owner: the delete dialog and
useCrossSeedWarningin the frontend.
Logs:
- None
Activity
0No activity yet.