Add try-catch to async IIFEs to prevent unhandled rejections
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1241,7 +1241,7 @@ function getAvgProcessTimeHorizontalBarChart(chartData, content, isSingle, xUnit
|
||||
// Created logic
|
||||
(async () => {
|
||||
isLoading.value = true;
|
||||
|
||||
try {
|
||||
const routeParams = route.params;
|
||||
const primaryType = routeParams.primaryType;
|
||||
const secondaryType = routeParams.secondaryType;
|
||||
@@ -1288,6 +1288,9 @@ function getAvgProcessTimeHorizontalBarChart(chartData, content, isSingle, xUnit
|
||||
compareDashboardData.value.freq.cases, contentData.freq, 'count');
|
||||
[casesByTaskData.value, casesByTaskOptions.value] = getCaseByTaskHorizontalBarChart(
|
||||
compareDashboardData.value.freq.cases_by_task, contentData.casesByTask, true, 'count');
|
||||
} catch (error) {
|
||||
console.error('Failed to initialize compare dashboard:', error);
|
||||
}
|
||||
})();
|
||||
|
||||
// Mounted
|
||||
|
||||
@@ -487,6 +487,7 @@ function setActivityBgImage(mapData) {
|
||||
|
||||
// Created logic
|
||||
(async () => {
|
||||
try {
|
||||
const routeParams = route.params;
|
||||
const file = route.meta.file;
|
||||
const isCheckPage = route.name.includes('Check');
|
||||
@@ -522,7 +523,6 @@ function setActivityBgImage(mapData) {
|
||||
await allMapDataStore.getFilterParams();
|
||||
await allMapDataStore.getTraceDetail();
|
||||
|
||||
isLoading.value = false;
|
||||
emitter.on('saveModal', boolean => {
|
||||
sidebarView.value = boolean;
|
||||
sidebarFilter.value = boolean;
|
||||
@@ -535,6 +535,11 @@ function setActivityBgImage(mapData) {
|
||||
sidebarTraces.value = boolean;
|
||||
sidebarState.value = boolean;
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Failed to initialize map compare:', error);
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
})();
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
|
||||
@@ -66,7 +66,7 @@ const { conformanceLogId, conformanceFilterId, conformanceLogCreateCheckId, conf
|
||||
// Created logic
|
||||
(async () => {
|
||||
isLoading.value = true;
|
||||
|
||||
try {
|
||||
const params = route.params;
|
||||
const file = route.meta.file;
|
||||
const isCheckPage = route.name.includes('Check');
|
||||
@@ -94,7 +94,11 @@ const { conformanceLogId, conformanceFilterId, conformanceLogCreateCheckId, conf
|
||||
await conformanceStore.getConformanceReport();
|
||||
}
|
||||
await conformanceStore.getConformanceParams();
|
||||
} catch (error) {
|
||||
console.error('Failed to initialize conformance:', error);
|
||||
} finally {
|
||||
setTimeout(() => isLoading.value = false, 500);
|
||||
}
|
||||
})();
|
||||
|
||||
// Mounted
|
||||
|
||||
@@ -470,6 +470,7 @@ function setActivityBgImage(mapData) {
|
||||
|
||||
// Created logic
|
||||
(async () => {
|
||||
try {
|
||||
const routeParams = route.params;
|
||||
const file = route.meta.file;
|
||||
const isCheckPage = route.name.includes('Check');
|
||||
@@ -505,7 +506,6 @@ function setActivityBgImage(mapData) {
|
||||
await allMapDataStore.getFilterParams();
|
||||
await allMapDataStore.getTraceDetail();
|
||||
|
||||
isLoading.value = false;
|
||||
emitter.on('saveModal', boolean => {
|
||||
sidebarView.value = boolean;
|
||||
sidebarFilter.value = boolean;
|
||||
@@ -518,6 +518,11 @@ function setActivityBgImage(mapData) {
|
||||
sidebarTraces.value = boolean;
|
||||
sidebarState.value = boolean;
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Failed to initialize map:', error);
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
})();
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
|
||||
@@ -905,6 +905,7 @@ function getAvgWaitingTimeLineChart(chartData, content, yUnit) {
|
||||
// Created logic
|
||||
(async () => {
|
||||
isLoading.value = true;
|
||||
try {
|
||||
const routeParams = route.params;
|
||||
const isCheckPage = route.name.includes('Check');
|
||||
const type = routeParams.type;
|
||||
@@ -920,7 +921,6 @@ function getAvgWaitingTimeLineChart(chartData, content, yUnit) {
|
||||
// 取得 Performance Data
|
||||
await performanceStore.getPerformance(type, id);
|
||||
if(!performanceData.value?.time) {
|
||||
isLoading.value = false;
|
||||
return;
|
||||
}
|
||||
avgProcessTimeByTaskHeight.value = getHorizontalBarHeight(performanceData.value.time.avg_process_time_by_task);
|
||||
@@ -948,8 +948,11 @@ function getAvgWaitingTimeLineChart(chartData, content, yUnit) {
|
||||
|
||||
[casesByTaskData.value, casesByTaskOptions.value] = getHorizontalBarChart(performanceData.value.freq.cases_by_task,
|
||||
contentData.casesByTask, true, 'count');
|
||||
// 停止 loading
|
||||
} catch (error) {
|
||||
console.error('Failed to initialize performance:', error);
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user