🐛 Fix bug with react hooks in disk usage component (#378)

This commit is contained in:
Anton Shepilov
2024-02-27 10:10:07 +01:00
committed by GitHub
parent a49ee3fddf
commit e1f10b76bb
@@ -16,19 +16,17 @@ const DiskUsage = () => {
const [usedBytes, setUsedBytes] = useState(0); const [usedBytes, setUsedBytes] = useState(0);
const [totalBytes, setTotalBytes] = useState(0); const [totalBytes, setTotalBytes] = useState(0);
if (FeatureTogglesService.isActiveFeatureName(FeatureNames.COMPANY_USER_QUOTA)) {
const { quota } = useUserQuota() const { quota } = useUserQuota()
useEffect(() => { useEffect(() => {
setUsed(Math.round(quota.used / quota.total * 100)) setUsed(Math.round(quota.used / quota.total * 100))
setUsedBytes(quota.used); setUsedBytes(quota.used);
setTotalBytes(quota.total); setTotalBytes(quota.total);
}, [quota]); }, [quota]);
} else if (viewId) {
const { item } = useDriveItem(viewId); const { item } = useDriveItem(viewId || "root");
useEffect(() => { useEffect(() => {
setUsedBytes(item?.size || 0); setUsedBytes(item?.size || 0);
}, [viewId, item]) }, [viewId, item])
}
return ( return (
<> <>