fix: stablize station select options

This commit is contained in:
yangsy
2025-08-25 11:08:14 +08:00
parent d15c3c2edf
commit 560ed3bad2
3 changed files with 13 additions and 33 deletions

View File

@@ -35,7 +35,16 @@ export function useStationListQuery() {
online: pingResultList[index].status === 'fulfilled',
}));
stationList.value.splice(0, stationList.value.length, ...stations);
const isSame =
stationList.value.length === stations.length &&
stationList.value.every((oldStation, index) => {
const newStation = stations[index];
return oldStation.code === newStation.code && oldStation.name === newStation.name && oldStation.deviceIdPrefix === newStation.deviceIdPrefix && oldStation.online === newStation.online;
});
if (!isSame) {
stationList.value.splice(0, stationList.value.length, ...stations);
}
updatedTime.value = dayjs().toJSON();