From 75e65ea828ad330a807943cb6a9dc210857867da Mon Sep 17 00:00:00 2001 From: Chandra Y Date: Mon, 24 Feb 2025 21:00:11 -0600 Subject: [PATCH] WP-865 - sending file to trash in shared workspaces (#1049) Co-authored-by: Garrett Edmonds <43251554+edmondsgarrett@users.noreply.github.com> --- .../DataFiles/DataFilesToolbar/DataFilesToolbar.jsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/client/src/components/DataFiles/DataFilesToolbar/DataFilesToolbar.jsx b/client/src/components/DataFiles/DataFilesToolbar/DataFilesToolbar.jsx index 8a3b94688..bd25e63fe 100644 --- a/client/src/components/DataFiles/DataFilesToolbar/DataFilesToolbar.jsx +++ b/client/src/components/DataFiles/DataFilesToolbar/DataFilesToolbar.jsx @@ -188,15 +188,18 @@ const DataFilesToolbar = ({ scheme, api }) => { } }; - const homeDir = selectedSystem?.homeDir; - const trashCallback = useCallback(() => { + // Specific handling for shared workspaces. + const homeDir = selectedSystem?.homeDir || ''; + const destSystem = selectedSystem?.system || selectedFiles[0]?.system; + if (!destSystem) return; + trash({ - destSystem: selectedSystem.system, - homeDir: homeDir, + destSystem, + homeDir, callback: reloadPage, }); - }, [selectedFiles, reloadPage, status]); + }, [selectedFiles, selectedSystem, reloadPage, status]); const empty = () => { dispatch({