Repository navigation
fix(mods): resolve startup mod updates notice when updates complete (#752) - #798
Conversation
Pixnop
left a comment
There was a problem hiding this comment.
I reviewed a560156d against dev adab6b96: ran your new tests against dev's code, then mounted Manage Mods with a recorded startup notice and tried a whole-folder Update all, an Update all with the search on, a scan with the ModDB unreachable, and an Installation switch during the 2 s delay.
The rescan in useManageInstalledMods.refresh is the right place for the fix. It judges the whole folder, and every update made on Manage Mods ends there: Update all flips _updatingMods (useBulkUpdateMods.ts:68 and :128), which reruns the scan (useManageInstalledMods.ts:46-47), and row updates call refresh. With a whole-folder Update all, the notice is resolved and leaves the screen, which is the case in #752. On dev's code the three test files fail, 2 of 67 tests plus two files at import, but only because the new API is missing. With both resolveStartupModUpdateNotice calls turned into no-ops, all 75 tests still pass, so nothing pins the fix itself.
Approving. Notes 1 to 4 are worth taking in this PR, since 1 and 3 are deletions. The rest can wait.
Not blocking
-
Update all with the search on closes the notice while other Mods still have updates. The page runs Update all on
visibleMods(ManageMods.tsx:232), andremainingUpdatable(useBulkUpdateMods.ts:112) only looks at that list. With Alpha and Beta updatable, I searched "alpha" and clicked Update all: the notice was resolved, and the rescan that followed still listed Beta under updates. The block is not needed: without it, I checked that the rescan closes the notice after a whole-folder Update all and keeps it after the filtered one. Removing the block, its import and theresolveNotificationdestructure fixes it. -
A scan whose ModDB lookups fail closes the notice.
_updatableTois only set when the lookup worked, so offline, or once a timeout makes the remaining lookups fail,updatableCountcan be 0 anduseManageInstalledMods.ts:61-64resolves the notice though nothing was updated. I reproduced it withqueryURLrejecting. The startup check already treats failed lookups as unknown (#618). PassingonFinishtogetCompleteInstalledModsinrefreshand resolving only whenfailedLookups === 0would match. -
The new timer cleanup loses the notice for the session.
ADD_NOTIFIED_MOD_UPDATEis dispatched (GlobalModUpdateChecker.tsx:31) before the timer starts (:33). If the player switches Installation during the 2 s, the cleanup at:59cancels the notice, and coming back does not post it again. A test that switches away and back passes on dev and fails here. The cleanup is outside #752, so I would drop it. If you want it, move the dispatch inside the timeout callback. -
The tests do not reach the paths that carry the fix. The new test at
globalModUpdateChecker.test.tsx:173resolves through a syntheticResolveNoticeButton.tests/renderer-dom/helpers/mountManageMods.tsxalready gives a ManageMods harness. Four cases would hold it: whole-folder Update all closes the notice, a filtered Update all that leaves Beta keeps it, failed lookups keep it, and a single row update closes it. -
A second notice for the same Installation orphans the first. When startup lookups partly failed, switching away and back posts the notice again (the #618 test shows two). A notice with an action is never folded into an earlier one, so
modUpdateNotices.ts:12overwrites the first id and only the second gets resolved: the first banner stays on screen, or in the Activity Center if it was closed with x. With the #618 setup, resolving after the revisit left one of the two banners up. Keeping a set of ids per Installation, or resolving the old id before recording a new one, covers it. -
Updates from the ModDB catalog page do not close the notice right away.
ModReleaseListcan update an installed Mod fromInstallMod.tsx:98, which never runs the Manage Mods rescan, so the notice waits for the next visit to Manage Mods. Fine if the module comment says so. -
Some new API surface is unused. Production code never sets
NotificationOptions.id(read atNotificationsContext.tsx:430), andgetStartupModUpdateNotice,clearStartupModUpdateNoticeand the boolean returned byresolveStartupModUpdateNoticeonly serve tests. SinceonCreatedruns synchronously,addNotificationreturning the id, as the issue suggested, would do the same with less. The reset helper would matchresetWhatsNewCacheForTestsas...ForTests.
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.
|
I reviewed Round oneUpdate all with the search on no longer closes the notice. The block in A scan with failed lookups keeps the notice. The timer cleanup is gone. The tests now go through Manage Mods. The A second notice no longer orphans the first. The set per Installation ( The catalog limit is in the module comment ( Still approved. Not blocking
|
Summary
When mod updates are detected on startup,
GlobalModUpdateCheckerdisplays an actionable notification banner ("The selected Installation has X Mods with updates available") with a "View updates" action. Because actionable notifications have no auto-dismiss timeout, the notice remained on screen indefinitely even after the player navigated to Manage Mods and completed "Update all" or updated the individual mods.This change:
options.onCreatedandoptions.idtoNotificationOptionsand introducesresolveNotification(id: string, resolvedWith?: string)toNotificationsContextto dismiss banners and mark records resolved in the Activity Center.modUpdateNotices.ts) tracking the active startup mod update notice per installation.useBulkUpdateModsand leaves no remaining updatable mods.useManageInstalledModsfinishes scanning and confirms zero updatable mods remain (covering single mod updates, manual installations, and deletions).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
npm run typecheck: passed with zero errors across node, web, and tests.npm run lint:ci: passed with zero errors across oxlint and eslint.npm run format:check: passed with 100% formatted.npm run test:coverage: passed with 305 test files (1927 tests passed, 2 skipped) with coverage floors exceeded:npm run build:unpack: passed with unpacked Linux binary generated indist/linux-unpacked.tests/renderer/modUpdateNotices.test.tsfor recording, retrieving, and resolving startup notice entries.tests/renderer-dom/activityCenter.test.tsxforoptions.onCreated,options.id, andresolveNotification.tests/renderer-dom/globalModUpdateChecker.test.tsxverifying startup notice tracking and dismissal upon resolution.Related issues
Fixes #752