Prevent duplicate downloads on export/download buttons#1659
Open
heyiamwahab236 wants to merge 2 commits into
Open
Prevent duplicate downloads on export/download buttons#1659heyiamwahab236 wants to merge 2 commits into
heyiamwahab236 wants to merge 2 commits into
Conversation
The 'Export VEX' and 'Export VDR' buttons had no guard against repeated clicks. Each click started a new blob download, so clicking while a download was already in progress triggered multiple simultaneous requests and duplicate file downloads. Each handler now sets an in-progress flag (guarded early-return), the corresponding button is disabled and shows a spinner while the export runs, and the flag is reset in a finally() block so the button re-enables whether the download succeeds or fails. Signed-off-by: Abdul Wahab Shah <abdul.shah@tecan.com>
The 'Download BOM' (inventory / with-vulnerabilities) and 'Download component' (CSV) dropdowns on the project Components view had no guard against repeated clicks, so each click started a new download and clicking while one was in progress produced duplicate downloads. Each handler now sets an in-progress flag (guarded early-return), the corresponding dropdown is disabled and shows a spinner while the export runs, and the flag is reset in finally() so it re-enables whether the download succeeds or fails. Signed-off-by: Abdul Wahab Shah <abdul.shah@tecan.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Author
|
@setchy Can you please have a look at this please. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Export/download buttons started a new download on every click with no
in-progress guard, so clicking (or double-clicking) while a download was
already running triggered multiple simultaneous requests and duplicate file
downloads. This affected the project Findings view (Export VEX, Export VDR)
and the project Components view (Download BOM — inventory / with-vulnerabilities,
and Download component — CSV).
Each handler now sets an in-progress flag with a guarded early return, disables
the corresponding button/dropdown and shows a spinner while the export runs, and
resets the flag in a
finally()block so the control re-enables whether thedownload succeeds or fails.
Addressed Issue
fixes #1658
Additional Details
The frontend project has no component unit-test harness, so this was verified
manually: with the Network tab open (throttled to Slow 3G to widen the window),
rapid/double clicks on each export control now send only one request and produce
a single download, and the control re-enables after completion or error. Verified
on the Findings (VEX/VDR) and Components (BOM/CSV) views.
Checklist
This PR introduces new or alters existing behavior, and I have updated the documentation accordingly