fix(installations): clear stale mod cache on delete and rename - #175
Open
arafuls wants to merge 2 commits into
Open
fix(installations): clear stale mod cache on delete and rename#175arafuls wants to merge 2 commits into
arafuls wants to merge 2 commits into
Conversation
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).
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
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
removeQueriesrather thaninvalidateQueriesin both spots. The old path's data is genuinely gone, not just possibly stale, and this avoidskeepPreviousDatamomentarily 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
oxfmt/oxlint/tsc --noEmitall pass cleanBreaking Changes (if any)
None.
Repro steps (pre-fix)
Checkout
releasebefore this PR's commit (or just check out the parent commit) to verify against the broken behavior.Scenario A — straightforward delete + recreate
Test, pick any game version, create it.Test→ Mods tab → Add mod → search for any mod (e.g. "BetterRuins") → install it.Test.Test(confirm the delete dialog).Test(same name as before) → create it.Test→ Mods 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
Modsfolder 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)
BugTest→ create it.BugTest→ Mods tab → install a mod (e.g. "BetterRuins").BugTest→ rename it toBugTest123→ save.BugTest123.BugTest(the original name, notBugTest123) → create it.BugTest→ Mods 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 originalBugTestpath abandoned at the rename step.Expected (post-fix): the mod shows as not installed.
Reviewers
@LovelessCodes (CODEOWNERS)