Skip to content

Make enabling, disabling or deleting a Mod in Manage Mods stop waiting on the ModDB - #806

Merged
Zaldaryon merged 4 commits into
devfrom
fix/issue-800-manage-mods-actions-network
Nov 11, 2026
Merged

Zaldaryon merged 4 commits into
devfrom
fix/issue-800-manage-mods-actions-network

Conversation

@Pixnop

@Pixnop Pixnop commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

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 refresh gets 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) and useGetCompleteInstalledMods.ts (the reuse), plus ManageMods.tsx where Reload asks for a full scan. Pull request #798 edits the same refresh function in useManageInstalledMods.ts, so whichever of the two merges second needs a rebase there.

Type

  • Bug fix
  • Feature
  • Performance
  • Refactor or cleanup
  • Tests only
  • Docs or build

Checklist

  • Targets dev, not main.
  • npm run typecheck passes.
  • npm run lint:ci passes.
  • npm run format:check passes.
  • npm run test:coverage passes, coverage at or above the floor in vitest.config.ts.
  • npm run build:unpack passes.

Testing

New file tests/renderer-dom/manageModsActionsNetwork.test.tsx, thirteen tests:

  • a toggle after a full scan makes no lookup and no logo request, and the list shows the new state;
  • after a full scan whose lookups all failed, a toggle resolves without any new lookup;
  • a Reload still in flight does not overwrite a later toggle;
  • a toggle overtaken by a Reload does not release its row on the old state, and the Reload spinner stays on until the Reload lands;
  • a full scan overtaken by a toggle still keeps its answers: the next toggle shows the newer release it found, with no new lookup;
  • an older full scan that lands after a newer one does not replace its answers, so the next toggle looks nothing up again;
  • Reload still runs a full scan;
  • a Mod the last scan never saw is looked up once after an action;
  • with the startup notice up, a toggle after a scan with a failed lookup does not resolve it, and neither does a toggle of another Mod while an update is still available;
  • updating the last updatable Mod from its row resolves the notice, and the scan that follows reads the other Mods from the cache;
  • updating the only updatable Mod while another lookup failed leaves the notice up, and the scan that follows makes no new lookup, so the cached failure is counted;
  • a full scan overtaken by a toggle does not resolve the notice from its older folder read.

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) and format:check are clean. I did not run npm run build:unpack locally, the packaged build is left to CI.

I merged dev in after #798 (the startup update notice) landed. Both sides edited refresh, so it now passes the cache and the onFinish that 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

…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.
@Pixnop
Pixnop requested a review from Zaldaryon November 10, 2026 22:21
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.

@Zaldaryon Zaldaryon left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Zaldaryon
Zaldaryon merged commit 848485c into dev Nov 11, 2026
12 checks passed
@Zaldaryon
Zaldaryon deleted the fix/issue-800-manage-mods-actions-network branch November 11, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants