refactor: 优化查询链的耗时和错误日志输出

This commit is contained in:
yangsy
2026-01-15 14:36:28 +08:00
parent 86775a6eb2
commit c4963b5b70
3 changed files with 14 additions and 9 deletions
@@ -35,8 +35,8 @@ export const useLineStationsMutation = () => {
stationStore.setStations(stations);
},
onError: (error) => {
console.error(error);
if (isCancel(error) || error instanceof CancelledError) return;
console.error(error);
const errorFeedback = parseErrorFeedback(error);
window.$message.error(errorFeedback);
},
@@ -57,9 +57,10 @@ export const useLineStationsQuery = () => {
refetchInterval: requestInterval * 1000,
staleTime: (requestInterval * 1000) / 2,
queryFn: async ({ signal }) => {
console.time(LINE_STATIONS_QUERY_KEY);
const startTime = performance.now();
await getLineStations({ signal }).catch(() => {});
console.timeEnd(LINE_STATIONS_QUERY_KEY);
const endTime = performance.now();
console.log(`${LINE_STATIONS_QUERY_KEY}: ${endTime - startTime} ms`);
if (!pollingEnabled.value) return null;
await refetchLineDevicesQuery();