From 1a0d6d414c2d04b0fc5cbe2bf42468830c2ecf1b Mon Sep 17 00:00:00 2001 From: Umesh Kumar <166806589+TangoBeeAkto@users.noreply.github.com> Date: Fri, 10 Jan 2025 15:13:00 +0530 Subject: [PATCH] fix: improve report PDF generation toast handling and prevent duplicate messages --- .../vulnerability_report/VulnerabilityReport.jsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/testing/vulnerability_report/VulnerabilityReport.jsx b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/testing/vulnerability_report/VulnerabilityReport.jsx index 775094ef5c..b3d20ba660 100644 --- a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/testing/vulnerability_report/VulnerabilityReport.jsx +++ b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/testing/vulnerability_report/VulnerabilityReport.jsx @@ -246,11 +246,15 @@ const VulnerabilityReport = () => { func.setToast(true, false, "Preparing your report. This might take a moment...") }, 1000) + let generationStarted = false setTimeout(() => { clearInterval(reportToastInterval) - reportToastInterval = setInterval(() => { - func.setToast(true, false, "Report PDF generation in progress. Please wait...") - }, 1000) + generationStarted = true + if(status === "IN_PROGRESS") { + reportToastInterval = setInterval(() => { + func.setToast(true, false, "Report PDF generation in progress. Please wait...") + }, 1000) + } }, 6000) try { @@ -276,7 +280,9 @@ const VulnerabilityReport = () => { await func.sleep(WAIT_DURATION) - func.setToast(true, false, "Report PDF generation in progress. Please wait...") + if(generationStarted) { + func.setToast(generationStarted, false, "Report PDF generation in progress. Please wait...") + } } } else { if(status !== "COMPLETED") {