From c1ca3a8bc57884e3243665c14230a557dcaa4d12 Mon Sep 17 00:00:00 2001 From: lunar-seal Date: Fri, 14 Aug 2026 19:49:28 +0200 Subject: [PATCH] fix: keep devices sorted by last active time when some last active times are null --- ...time_when_some_devices_have_a_missing_last_active_time.md | 5 +++++ src/app/features/settings/devices/OtherDevices.tsx | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 .changeset/fix_sorting_devices_by_last_active_time_when_some_devices_have_a_missing_last_active_time.md diff --git a/.changeset/fix_sorting_devices_by_last_active_time_when_some_devices_have_a_missing_last_active_time.md b/.changeset/fix_sorting_devices_by_last_active_time_when_some_devices_have_a_missing_last_active_time.md new file mode 100644 index 0000000000..4adac9fbdd --- /dev/null +++ b/.changeset/fix_sorting_devices_by_last_active_time_when_some_devices_have_a_missing_last_active_time.md @@ -0,0 +1,5 @@ +--- +default: patch +--- + +# Fix sorting devices by last active time when some devices have a missing last active time. diff --git a/src/app/features/settings/devices/OtherDevices.tsx b/src/app/features/settings/devices/OtherDevices.tsx index 0dec613f1e..dd6ca6b3f0 100644 --- a/src/app/features/settings/devices/OtherDevices.tsx +++ b/src/app/features/settings/devices/OtherDevices.tsx @@ -186,8 +186,7 @@ export function OtherDevices({ devices, refreshDeviceList, showVerification }: O )} {devices .toSorted((d1, d2) => { - if (!d1.last_seen_ts || !d2.last_seen_ts) return 0; - return d1.last_seen_ts < d2.last_seen_ts ? 1 : -1; + return (d1.last_seen_ts ?? 0) < (d2.last_seen_ts ?? 0) ? 1 : -1; }) .map((device) => (