Repository navigation
Make enabling, disabling or deleting a Mod in Manage Mods stop waiting on the ModDB - #806
Merged
Merged
Conversation
…g on the ModDB A single-Mod action now re-reads the folder and reuses what the last full scan learned for each Mod id, logo misses and failed lookups included, so it never waits on the network. Opening the page, Reload, an Installation change and the rescan after Update all or a profile switch still do a full scan, and a scan may set the list unless a scan that started later already did.
refresh now passes both the scan cache and the onFinish that resolves the startup update notice from #798. onFinish skips a scan already superseded by an applied one, so an older folder read cannot resolve the notice.
7 of 12 tasks
Zaldaryon
approved these changes
Nov 11, 2026
Zaldaryon
left a comment
Collaborator
There was a problem hiding this comment.
Action refreshes now reuse completed ModDB and logo results, while explicit Reload and other full-scan paths refresh those results. Scan ordering prevents an older folder read from replacing newer state or ending its spinner early. The regression tests cover cached successes, misses, failed lookups and overlapping scans. Focused tests passed: 13. Required CI checks are green. This PR covers only part of #800.
1 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In Manage Mods, enabling, disabling or deleting a Mod, or updating one from its row, made the page wait on the network. Every one of those actions ran the full scan again: one ModDB lookup per Mod and a logo step for each Mod with a ModDB logo, two lookups at a time. In the logs from #800 that is about ten seconds per toggle with 49 Mods, and longer offline.
Now an action on the Mods folder re-reads the folder and reuses what the page's last full scan learned, keyed by mod id: the ModDB details and the outcome of the logo step, misses included. No request is made for an id the last full scan already handled, whether its lookup found the Mod, answered not found or failed. An id that failed stays "not checked" until the next full scan. A Mod the last scan never saw, one that just arrived in the folder, is looked up once, for that id only. Update badges are recomputed locally from the reused releases. Every flow that calls
refreshgets this, so batch enable, disable and delete, modpack import, the install popup and closing the Update all summary reuse the answers too.I also added a guard in
refresh. Without it, a Reload still waiting on the ModDB could overwrite a later toggle with its older folder read. A scan may set the list unless a scan that started later already did, and only the latest scan clears the loading state. A full scan that is overtaken still keeps its fresh answers for later actions, unless a full scan that started later already left newer ones: answers are only adopted from a scan that started after the ones already held.What stays as it was: opening the page, an Installation change, Reload, and the rescan after Update all or a Mod profile switch still do a full scan with the network. Showing the list before the lookups answer is left for later, so #800 stays open for the wait when the page opens.
The change is in
useManageInstalledMods.ts(refresh) anduseGetCompleteInstalledMods.ts(the reuse), plusManageMods.tsxwhere Reload asks for a full scan. Pull request #798 edits the same refresh function inuseManageInstalledMods.ts, so whichever of the two merges second needs a rebase there.Type
Checklist
dev, notmain.npm run typecheckpasses.npm run lint:cipasses.npm run format:checkpasses.npm run test:coveragepasses, coverage at or above the floor invitest.config.ts.npm run build:unpackpasses.Testing
New file
tests/renderer-dom/manageModsActionsNetwork.test.tsx, thirteen tests:Run alone on
dev, the two toggle tests, the Reload-in-flight test and the new-Mod test fail; the Reload test passes there because it guards today's behaviour. The overtaken-toggle test fails with the first version of the guard that returned before setting the list. The two answer-keeping tests fail when the answers are adopted after the guard or without the started-later check.Full suite: 306 files, 5968 passed, 4 skipped. Coverage: 95.11% statements, 91.35% branches, 95.91% functions, 97.05% lines. Typecheck,
lint:ci(warnings only, none new) andformat:checkare clean. I did not runnpm run build:unpacklocally, the packaged build is left to CI.I merged
devin after #798 (the startup update notice) landed. Both sides editedrefresh, so it now passes the cache and theonFinishthat resolves the notice. The cached answers keep their failed lookups and their releases, so a cached refresh counts failures and updates exactly like a fresh one. A scan that a newer applied scan has already superseded no longer resolves the notice, since the newer scan reports for itself.Related issues
Part of #800