fix(maintenance): prevent placeholder flash when maintenance items exist (#2286)

This commit is contained in:
mohadeseh safari
2025-05-27 19:54:31 -04:00
parent 5b86d892c5
commit e6c2e34b78

View File

@@ -25,6 +25,7 @@ const Maintenance = () => {
const [sort, setSort] = useState({});
const [updateTrigger, setUpdateTrigger] = useState(false);
const [networkError, setNetworkError] = useState(false);
const [isDataFetched, setIsDataFetched] = useState(false);
const handleActionMenuDelete = () => {
setUpdateTrigger((prev) => !prev);
@@ -42,6 +43,8 @@ const Maintenance = () => {
setMaintenanceWindowCount(maintenanceWindowCount);
} catch (error) {
setNetworkError(true);
} finally {
setIsDataFetched(true);
}
};
fetchMaintenanceWindows();
@@ -61,7 +64,8 @@ const Maintenance = () => {
</GenericFallback>
);
}
if (maintenanceWindows.length === 0) {
// Only show the fallback if we've fetched data and there are no maintenance windows
if (isDataFetched && maintenanceWindows.length === 0) {
return (
<Fallback
title="maintenance window"