Skip to content

A local-first personal finance app

[AI] Sort schedules alphabetically in Automations UI (#7913)

Mats Nilssond0fbeb68cf83
diff --git a/packages/desktop-client/src/components/budget/goals/editor/ScheduleAutomation.tsx b/packages/desktop-client/src/components/budget/goals/editor/ScheduleAutomation.tsx
index 6ce7e3964f..238119129a 100644
--- a/packages/desktop-client/src/components/budget/goals/editor/ScheduleAutomation.tsx
+++ b/packages/desktop-client/src/components/budget/goals/editor/ScheduleAutomation.tsx
@@ -28,10 +28,16 @@ export const ScheduleAutomation = ({
// tombstoned schedules aren't selectable, so a category whose only
// schedules are completed should fall through to the "no schedules" state
// instead of showing an empty picker.
- const selectableSchedules = schedules.filter(
- (s): s is typeof s & { name: string } =>
- !!s.name && !s.completed && !s.tombstone,
- );
+ const selectableSchedules = schedules
+ .filter(
+ (s): s is typeof s & { name: string } =>
+ !!s.name && !s.completed && !s.tombstone,
+ )
+ .sort((a, b) =>
+ a.name.trim().localeCompare(b.name.trim(), undefined, {
+ ignorePunctuation: true,
+ }),
+ );
return selectableSchedules.length ? (
<>
diff --git a/upcoming-release-notes/7913.md b/upcoming-release-notes/7913.md
new file mode 100644
index 0000000000..b0bc75e1dc
--- /dev/null
+++ b/upcoming-release-notes/7913.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [mnil]
+---
+
+Schedules are now sorted alphabetically in the Automations UI.