From e164d87209543b8bdfaf9c8b248dc5bc36ac721c Mon Sep 17 00:00:00 2001 From: Fine0830 Date: Mon, 25 Nov 2024 11:26:42 +0800 Subject: [PATCH] Fix: releases an existing object URL (#433) --- src/utils/file.ts | 4 +++- src/views/dashboard/panel/Layout.vue | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/utils/file.ts b/src/utils/file.ts index 0902bf8d..2e8b5254 100644 --- a/src/utils/file.ts +++ b/src/utils/file.ts @@ -37,8 +37,10 @@ export const saveFile = (data: any, name: string) => { tagA.download = name; tagA.style.display = "none"; const blob = new Blob([newData]); - tagA.href = URL.createObjectURL(blob); + const url = URL.createObjectURL(blob); + tagA.href = url; document.body.appendChild(tagA); tagA.click(); document.body.removeChild(tagA); + URL.revokeObjectURL(url); }; diff --git a/src/views/dashboard/panel/Layout.vue b/src/views/dashboard/panel/Layout.vue index 9a93aae4..5c9965a8 100644 --- a/src/views/dashboard/panel/Layout.vue +++ b/src/views/dashboard/panel/Layout.vue @@ -77,7 +77,7 @@ limitations under the License. --> } } async function queryMetrics() { - const widgets = []; + const widgets: LayoutConfig[] = []; for (const item of dashboardStore.layout) { if (item.type === WidgetType.Widget) { if (!ListChartTypes.includes(item.graph?.type || "")) {