aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2026-10-31 19:31:07 -0500
committerJP Dillingham <jp@dillingham.me>2026-10-31 19:31:07 -0500
commit926446c443afca46b853a0b8f5fa85297b56ede2 (patch)
tree55a2a665cf2f820d07662724c0d850446b439840 /src
parent9cc83bcbb8cc81e035e62fb1f636dcbf77ea7d19 (diff)
downloadslskd-926446c443afca46b853a0b8f5fa85297b56ede2.tar.gz
fix file list not updating after deleting, prevent infinite spinner
Diffstat (limited to 'src')
-rw-r--r--src/web/src/components/System/Files/Explorer.jsx27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/web/src/components/System/Files/Explorer.jsx b/src/web/src/components/System/Files/Explorer.jsx
index ca0bdba1..a4f0bbbe 100644
--- a/src/web/src/components/System/Files/Explorer.jsx
+++ b/src/web/src/components/System/Files/Explorer.jsx
@@ -9,6 +9,7 @@ const FileRow = ({
length,
modifiedAt,
name,
+ onDeleted,
remoteFileManagement,
root,
subdirectory,
@@ -34,7 +35,7 @@ const FileRow = ({
path: `${subdirectory.join('/')}/${fullName}`,
root,
});
- fetch();
+ onDeleted();
},
},
]}
@@ -66,6 +67,7 @@ const DirectoryRow = ({
modifiedAt,
name,
onClick = () => {},
+ onDeleted,
remoteFileManagement,
root,
subdirectory,
@@ -94,7 +96,7 @@ const DirectoryRow = ({
path: `${subdirectory.join('/')}/${fullName}`,
root,
});
- fetch();
+ onDeleted();
},
},
]}
@@ -131,12 +133,19 @@ const Explorer = ({ remoteFileManagement, root }) => {
const fetch = async () => {
setLoading(true);
- const directoryResult = await list({
- root,
- subdirectory: subdirectory.join('/'),
- });
- setDirectory(directoryResult);
- setLoading(false);
+
+ try {
+ const directoryResult = await list({
+ root,
+ subdirectory: subdirectory.join('/'),
+ });
+ setDirectory(directoryResult);
+ } catch (error) {
+ console.error(error);
+ setDirectory({ directories: [], files: [] });
+ } finally {
+ setLoading(false);
+ }
};
useEffect(() => {
@@ -281,6 +290,7 @@ const Explorer = ({ remoteFileManagement, root }) => {
<DirectoryRow
key={d.name}
onClick={() => select({ path: d.name })}
+ onDeleted={fetch}
remoteFileManagement={remoteFileManagement}
root={root}
subdirectory={subdirectory}
@@ -290,6 +300,7 @@ const Explorer = ({ remoteFileManagement, root }) => {
{sortedFiles?.map((f) => (
<FileRow
key={f.name}
+ onDeleted={fetch}
remoteFileManagement={remoteFileManagement}
root={root}
subdirectory={subdirectory}