fix: stablize station select options
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user