refactor(widgets): stabilize widget components after useQuery migration
Add WidgetEmptyState component for widgets that need a loading fallback. Disable refetch-on-mount/focus/reconnect and retry for integration widgets so cached data is preserved. Ensure hooks are never called conditionally.
This commit is contained in:
1 parent
f7f6d1e382
commit
f49ae79c99
17 files changed
+59
-20
No files matched your search
@@ -7,6 +7,7 @@ import { useRequiredBoard } from "@homarr/boards/context";
|
||||
import { humanFileSize } from "@homarr/common";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
|
||||
import { WidgetEmptyState } from "../common/empty-state";
|
||||
import type { WidgetComponentProps } from "../definition";
|
||||
import { NoIntegrationDataError } from "../errors/no-data-integration";
|
||||
|
||||
@@ -49,7 +50,7 @@ export default function SystemResources({ integrationIds, options }: WidgetCompo
|
||||
|
||||
const lastItem = data.at(-1);
|
||||
|
||||
if (!lastItem) return null;
|
||||
if (!lastItem) return <WidgetEmptyState />;
|
||||
const { fileSystem, smart } = lastItem.healthInfo;
|
||||
|
||||
if (fileSystem.length === 0) {
|
||||
|
||||
Reference in new issue
Block a user