perf: ignore CancelledError in all queries, and show error message in route pages

This commit is contained in:
yangsy
2025-09-12 13:29:01 +08:00
parent 2ddab88a92
commit 2a95b40b9e
6 changed files with 44 additions and 12 deletions

View File

@@ -4,7 +4,7 @@ import { STATION_LIST_QUERY_KEY } from '@/constants';
import { useQueryControlStore } from '@/stores/query-control';
import { useStationStore } from '@/stores/station';
import { getAppEnvConfig } from '@/utils/env';
import { useMutation, useQuery } from '@tanstack/vue-query';
import { isCancelledError, useMutation, useQuery } from '@tanstack/vue-query';
import axios from 'axios';
import dayjs from 'dayjs';
import { storeToRefs } from 'pinia';
@@ -60,5 +60,10 @@ function useStationListMutation() {
stationList.value.splice(0, stationList.value.length, ...stations);
}
},
onError: (error) => {
if (!isCancelledError(error)) {
throw error;
}
},
});
}