Skip to content

fix(installations): clear stale mod cache on delete and rename - #175

Open
arafuls wants to merge 2 commits into
LovelessCodes:releasefrom
arafuls:fix/stale-mod-cache-after-installation-delete
Open

fix(installations): clear stale mod cache on delete and rename#175
arafuls wants to merge 2 commits into
LovelessCodes:releasefrom
arafuls:fix/stale-mod-cache-after-installation-delete

Conversation

@arafuls

@arafuls arafuls commented Aug 4, 2026

Copy link
Copy Markdown

Summary

Installation paths are name-derived with no uniqueness suffix, so a later installation can reuse an earlier one's exact path. The mods cache for that path (useInstalledMods/useModUpdates, staleTime: Infinity) never expires and was never cleared, so the new installation would silently inherit stale "mods installed here" data. The Add Mod flow would then think an already-latest version was present and offer alternate versions instead of letting it download.

Changes

  • Clears both caches for the abandoned path in two places:
    • deleteinstallation.dialog.tsx on full deletion.
    • installation.dialog.tsx on rename, which orphans a path the exact same way a delete does, just without ever calling the delete command. This was found via testing: an initial version of this fix only handled deletion, and renaming before deleting reproduced the same stale-cache symptom through a path the first fix never touched.
  • Uses removeQueries rather than invalidateQueries in both spots. The old path's data is genuinely gone, not just possibly stale, and this avoids keepPreviousData momentarily surfacing it again if the path gets reused before a fresh fetch resolves.

Related Issues

N/A

Screenshots / Demos (if applicable)

No UI changes.

Checklist

  • I have linked related issues using # — N/A, see above
  • I have updated documentation where appropriate — no docs affected
  • I have verified backward compatibility or noted breaking changes — see below
  • I have run linters/formatters and addressed warnings — oxfmt/oxlint/tsc --noEmit all pass clean

Breaking Changes (if any)

None.

Repro steps (pre-fix)

Checkout release before this PR's commit (or just check out the parent commit) to verify against the broken behavior.

Scenario A — straightforward delete + recreate

  1. InstallationsAdd Installation → name it Test, pick any game version, create it.
  2. Open TestMods tab → Add mod → search for any mod (e.g. "BetterRuins") → install it.
  3. Confirm it now shows as installed for Test.
  4. Go back to Installations, delete Test (confirm the delete dialog).
  5. Add Installation again → name it Test (same name as before) → create it.
  6. Open the new TestMods tab → search for the same mod.

Broken (pre-fix): the mod's version picker shows it as already installed at the latest version and offers alternate/older versions instead of letting you install the latest — even though this is a brand-new installation with an empty Mods folder on disk.
Expected (post-fix): the mod shows as not installed, and installing it downloads normally.

Scenario B — rename before delete (the gap the first version of this fix missed)

  1. InstallationsAdd Installation → name it BugTest → create it.
  2. Open BugTestMods tab → install a mod (e.g. "BetterRuins").
  3. Edit BugTest → rename it to BugTest123 → save.
  4. Delete BugTest123.
  5. Add Installation again → name it BugTest (the original name, not BugTest123) → create it.
  6. Open the new BugTestMods tab → search for the same mod.

Broken (pre-fix): same symptom as Scenario A — the mod incorrectly shows as already installed. This path specifically confirms the rename case, since deletion only ever touched BugTest123's cache, never the original BugTest path abandoned at the rename step.
Expected (post-fix): the mod shows as not installed.

Reviewers

@LovelessCodes (CODEOWNERS)

Installation paths are name-derived with no uniqueness suffix, so a
later installation can reuse an earlier one's exact path. The mods
cache for that path (useInstalledMods/useModUpdates, staleTime:
Infinity) never expires and was never cleared, so the new installation
would silently inherit stale "mods installed here" data — the Add Mod
flow would then think an already-latest version was present and offer
alternate versions instead of letting it download.

Clears both caches for the abandoned path in two places: on full
deletion, and on rename (renaming creates the exact same kind of
orphaned path, just without a delete ever happening).
@arafuls
arafuls requested a review from LovelessCodes as a code owner August 4, 2026 19:24
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.

1 participant