Skip to content

Commit

Permalink
Merge pull request #1113 from PintoGideon/prototype-downloads
Browse files Browse the repository at this point in the history
refactor: Temporary hack to avoid breaking the issue in prod
  • Loading branch information
PintoGideon authored Mar 14, 2024
2 parents 98f99c9 + e2dfd2e commit b8d663d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/components/FeedOutputBrowser/FileBrowser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const FileBrowser = (props: FileBrowserProps) => {
const { pluginFilesPayload, handleFileClick, selected, filesLoading } = props;
const selectedFile = useTypedSelector((state) => state.explorer.selectedFile);
const drawerState = useTypedSelector((state) => state.drawers);
const feed = useTypedSelector((state) => state.feed.currentFeed.data);
const dispatch = useDispatch();
const [currentRowIndex, setCurrentRowIndex] = React.useState(0);
const { files, folders, path } = pluginFilesPayload;
Expand Down Expand Up @@ -78,9 +79,22 @@ const FileBrowser = (props: FileBrowserProps) => {
// Append the anchor element to the document body
document.body.appendChild(link);

// A temporary hack to avoid having this feature break in prod

await feed?.put({
//@ts-ignore
//js client needs to be updated
public: true,
});

// Programmatically trigger the download
link.click();

await feed?.put({
//@ts-ignore
public: false,
});

// Remove the anchor element from the document body after the download is initiated
document.body.removeChild(link);

Expand Down

0 comments on commit b8d663d

Please sign in to comment.