feat: make Updates discovery atomic (Closes #753)
CI / lint (pull_request) Successful in 1m43s
CI / build-release (pull_request) Successful in 5s
CI / release-candidate (pull_request) Has been skipped

This commit is contained in:
timmy committed 2026-08-13 16:25:03 +00:00
1 parent de6d6d0e61
commit 1f034a6f64
5 files changed
+110 -3

No files matched your search

+9 -1
View File
@@ -1008,7 +1008,15 @@
const updateTriageLauncher = createUpdateTriageLauncher({
selectUpdates: () => selectMobileQueue('update'),
discover: () => notificationPager.loadAll(() => lastNotifications),
discover: () => api('api/v1/notifications/snapshot'),
applySnapshot: snapshot => {
lastNotifications = snapshot.items || [];
notificationPager.reset({page:1, total:snapshot.total || 0, has_more:false});
if (lastContextSnapshot) {
lastContextSnapshot.notifications = lastNotifications;
paintMyWork(lastContextSnapshot);
}
},
isUpdatesSelected: () => selectedWorkFilter === 'update',
hasMore: () => Boolean(notificationPagination.has_more),
hasCheckpoint: () => updateTriage.resumable(),
+7 -2
View File
@@ -10,9 +10,14 @@
options.announce('Checking all unread updates…');
pending = Promise.resolve()
.then(() => options.discover())
.then(complete => {
.then(discovery => {
if (!options.isUpdatesSelected()) return 'cancelled';
if (complete === false || options.hasMore()) {
if (discovery === false || discovery?.complete === false) {
options.announce('Updates check paused. Retry to check older unread updates.');
return 'incomplete';
}
if (discovery?.complete) options.applySnapshot?.(discovery);
if (options.hasMore()) {
options.announce('Updates check paused. Retry to check older unread updates.');
return 'incomplete';
}