mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 14:15:24 +00:00
fix(file-manager): refresh disk usage with directory listing (#1503)
This commit is contained in:
1 parent
f6ea218100
commit
126a8c433b
1 file changed
+11
-2
@@ -3316,11 +3316,17 @@ function FileManagerContent({
|
||||
}, [currentPath]);
|
||||
|
||||
useEffect(() => {
|
||||
if (currentHost?.id) loadPinnedFiles();
|
||||
}, [currentHost?.id]);
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
setDiskInfo(null);
|
||||
if (currentHost?.id) {
|
||||
loadPinnedFiles();
|
||||
// Undefined while the host-metrics plugin is off: no disk bar then.
|
||||
invokeAction("host-metrics.disk", currentHost.id)
|
||||
.then((result) => {
|
||||
if (cancelled) return;
|
||||
const disk = result as HostDiskInfo | null | undefined;
|
||||
if (disk?.percent != null && disk.usedHuman && disk.totalHuman) {
|
||||
setDiskInfo({
|
||||
@@ -3334,7 +3340,10 @@ function FileManagerContent({
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
}, [currentHost?.id]);
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [currentHost?.id, lastRefreshTime]);
|
||||
|
||||
useEffect(() => {
|
||||
localStorage.setItem("fileManagerDensity", density);
|
||||
|
||||
Reference in new issue
Block a user