RockteMQ-AI commented on code in PR #1688:
URL:
https://github.com/apache/rocketmq-dashboard/pull/1688#discussion_r3790506947
##########
web/src/utils/download.ts:
##########
@@ -21,8 +21,11 @@ export const downloadBlob = (blob: Blob, filename: string)
=> {
anchor.href = url;
anchor.download = filename;
anchor.style.display = 'none';
- document.body.appendChild(anchor);
- anchor.click();
- anchor.remove();
- URL.revokeObjectURL(url);
+ try {
+ document.body.appendChild(anchor);
+ anchor.click();
+ } finally {
Review Comment:
**[Info]** Good use of `try/finally` to guarantee cleanup. One minor
suggestion: consider adding a brief comment explaining why the `finally` block
is important (prevents DOM node and Blob URL leaks on failed downloads), as
this is a subtle resource-management pattern that future contributors may not
immediately recognize.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]