Skip to content

Commit

Permalink
fix: improve report PDF generation toast handling and prevent duplica…
Browse files Browse the repository at this point in the history
…te messages
  • Loading branch information
TangoBeeAkto committed Jan 10, 2025
1 parent 2d84bf9 commit 1a0d6d4
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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") {
Expand Down

0 comments on commit 1a0d6d4

Please sign in to comment.