Commit 20565b9
refactor(settings): clean up decodeDestinations — deduplicate staleThreshold parse, simplify migration predicate, align in-memory settingsVersion with post-migration state
- Extract staleThresholdMinutes parse+coerce to a local val so it is
computed once and reused for both staleThresholdMinutes and the lower
bound of missedThresholdMinutes (was called twice with identical args).
- Simplify `if (itemSettingsVersion < 1 && stored) false else stored`
to the left-to-right equivalent `stored && itemSettingsVersion >= 1`.
- Change `settingsVersion = itemSettingsVersion` to
`settingsVersion = maxOf(1, itemSettingsVersion)` so the in-memory
Destination object reflects its post-migration version (1) rather than
the raw on-disk value (0). This keeps the in-memory and on-disk
representations consistent and makes future migration logic safe to
read from either source.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 4a99aa2 commit 20565b9
1 file changed
Lines changed: 6 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
586 | 586 | | |
587 | 587 | | |
588 | 588 | | |
| 589 | + | |
| 590 | + | |
589 | 591 | | |
590 | 592 | | |
591 | 593 | | |
| |||
625 | 627 | | |
626 | 628 | | |
627 | 629 | | |
628 | | - | |
| 630 | + | |
629 | 631 | | |
630 | 632 | | |
631 | 633 | | |
| |||
639 | 641 | | |
640 | 642 | | |
641 | 643 | | |
642 | | - | |
643 | | - | |
644 | | - | |
645 | | - | |
| 644 | + | |
646 | 645 | | |
647 | 646 | | |
648 | 647 | | |
649 | | - | |
650 | | - | |
651 | | - | |
652 | | - | |
653 | | - | |
| 648 | + | |
654 | 649 | | |
655 | 650 | | |
656 | 651 | | |
657 | 652 | | |
658 | | - | |
| 653 | + | |
659 | 654 | | |
660 | 655 | | |
661 | 656 | | |
| |||
0 commit comments