Skip to content

Commit e0e3a22

Browse files
saphidclaude
andcommitted
fix(web): drop saved snooze favorites too short to wake
A stored favorite under a millisecond resolved to "now", so no menu offered it, nor its remove control, while it still took one of the five slots. Settings decoding now drops it like an overlong one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent ca84a38 commit e0e3a22

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎packages/contracts/src/settings.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,7 @@ describe("ClientSettings snooze favorites", () => {
12011201
{ amount: 60, unit: "minutes" },
12021202
{ amount: 2, unit: "hours" },
12031203
{ amount: 1e9, unit: "days" },
1204+
{ amount: 0.000001, unit: "minutes" },
12041205
{ amount: 3, unit: "hours" },
12051206
{ amount: 4, unit: "hours" },
12061207
{ amount: 5, unit: "hours" },

‎packages/contracts/src/settings.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ export function snoozeFavoriteDurationMs(favorite: SnoozeFavorite): number {
338338
/**
339339
* One favorite per length ("60 minutes" and "1 hour" are the same choice), at
340340
* most {@link MAX_SNOOZE_FAVORITES} of them with the newest kept, and none
341-
* too long to wake. Settings decoding applies it, so stored or imported
341+
* too short or too long to wake. Settings decoding applies it, so stored or imported
342342
* favorites follow the same rules as saving one. Unchanged input is returned
343343
* as is.
344344
*/
@@ -348,7 +348,10 @@ export function normalizeSnoozeFavorites(
348348
const seen = new Set<number>();
349349
const kept = favorites.filter((favorite) => {
350350
const durationMs = snoozeFavoriteDurationMs(favorite);
351-
if (durationMs > MAX_SNOOZE_FAVORITE_MS || seen.has(durationMs)) return false;
351+
// Under a millisecond a wake lands on "now", which no menu can offer.
352+
if (durationMs < 1 || durationMs > MAX_SNOOZE_FAVORITE_MS || seen.has(durationMs)) {
353+
return false;
354+
}
352355
seen.add(durationMs);
353356
return true;
354357
});

0 commit comments

Comments
 (0)