mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 06:05: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]);
|
}, [currentPath]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (currentHost?.id) loadPinnedFiles();
|
||||||
|
}, [currentHost?.id]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let cancelled = false;
|
||||||
|
setDiskInfo(null);
|
||||||
if (currentHost?.id) {
|
if (currentHost?.id) {
|
||||||
loadPinnedFiles();
|
|
||||||
// Undefined while the host-metrics plugin is off: no disk bar then.
|
// Undefined while the host-metrics plugin is off: no disk bar then.
|
||||||
invokeAction("host-metrics.disk", currentHost.id)
|
invokeAction("host-metrics.disk", currentHost.id)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
|
if (cancelled) return;
|
||||||
const disk = result as HostDiskInfo | null | undefined;
|
const disk = result as HostDiskInfo | null | undefined;
|
||||||
if (disk?.percent != null && disk.usedHuman && disk.totalHuman) {
|
if (disk?.percent != null && disk.usedHuman && disk.totalHuman) {
|
||||||
setDiskInfo({
|
setDiskInfo({
|
||||||
@@ -3334,7 +3340,10 @@ function FileManagerContent({
|
|||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
}
|
}
|
||||||
}, [currentHost?.id]);
|
return () => {
|
||||||
|
cancelled = true;
|
||||||
|
};
|
||||||
|
}, [currentHost?.id, lastRefreshTime]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
localStorage.setItem("fileManagerDensity", density);
|
localStorage.setItem("fileManagerDensity", density);
|
||||||
|
|||||||
Reference in new issue
Block a user