perf: optimize query and device tree

This commit is contained in:
yangsy
2025-09-04 10:41:45 +08:00
parent 3e45bb212a
commit 80feb909de
3 changed files with 24 additions and 30 deletions

View File

@@ -8,7 +8,7 @@ import type { StationDevices } from './domains';
import { useLineDevicesStore } from '@/stores/line-devices';
import { LINE_DEVICES_QUERY_KEY } from '@/constants';
import { ndmClient } from '@/apis/client';
import { sleep } from '@/utils/sleep';
import { sleep, sleepFrame, sleepIdle } from '@/utils/sleep';
import type { Station } from '@/apis/domains';
const createEmptyStationDevices = (): StationDevices => {
@@ -77,7 +77,7 @@ function useStationDevicesMutation() {
},
onSuccess: async (stationDevices, { station }) => {
lineDevices.value[station.code] = stationDevices;
await sleep();
await sleepFrame();
},
onError: (error, { station }) => {
console.error(`获取车站 ${station.name} 设备数据失败:`, error);