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) => (