From ed090fa900e4b747d7eccd1dbae6e72c65bb345e Mon Sep 17 00:00:00 2001 From: PintoGideon Date: Mon, 18 Mar 2024 14:24:55 -0400 Subject: [PATCH] refactor: replace load with a timeout --- src/components/FeedOutputBrowser/FileBrowser.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/components/FeedOutputBrowser/FileBrowser.tsx b/src/components/FeedOutputBrowser/FileBrowser.tsx index 6fc65ed7d..b3fcc8424 100644 --- a/src/components/FeedOutputBrowser/FileBrowser.tsx +++ b/src/components/FeedOutputBrowser/FileBrowser.tsx @@ -76,7 +76,6 @@ const FileBrowser = (props: FileBrowserProps) => { }; const makeDataSourcePrivate = async () => { - console.log("Make it private again"); // Implement logic to make the data source private again await feed?.put({ //@ts-ignore @@ -107,10 +106,6 @@ const FileBrowser = (props: FileBrowserProps) => { link.download = fileName; // Set the download attribute to specify the filename // Append the anchor element to the document body // Listen for the load event on the anchor element - link.onload = async () => { - // Make the data source private again after the download is done - privateFeed && (await makeDataSourcePrivate()); - }; document.body.appendChild(link); // Programmatically trigger the download @@ -118,6 +113,10 @@ const FileBrowser = (props: FileBrowserProps) => { // Remove the anchor element from the document body after the download is initiated document.body.removeChild(link); + setTimeout(async () => { + privateFeed && (await makeDataSourcePrivate()); + }, 2000); // Adjust the delay time as needed + return item; } catch (e) { throw e;