Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Bind retained resource read errors to the consuming hook option

pulse-triage[bot]7b7f278b1a4e
diff --git a/frontend-modern/src/components/Workloads/__tests__/GuestPhysicalDisks.test.tsx b/frontend-modern/src/components/Workloads/__tests__/GuestPhysicalDisks.test.tsx
index 8131e5c45d..d1bbaaff67 100644
--- a/frontend-modern/src/components/Workloads/__tests__/GuestPhysicalDisks.test.tsx
+++ b/frontend-modern/src/components/Workloads/__tests__/GuestPhysicalDisks.test.tsx
@@ -463,7 +463,9 @@ describe('GuestPhysicalDisks', () => {
const active = document.activeElement;
setError(undefined);
await Promise.resolve();
- expect(document.activeElement).toBe(active);
+ // A removed retry cannot keep focus. Hidden content must leave it on
+ // body rather than focusing the now-hidden inspection heading.
+ expect(document.activeElement).toBe(scenario === 'hidden' ? document.body : active);
},
);
diff --git a/frontend-modern/src/hooks/useUnifiedResources.ts b/frontend-modern/src/hooks/useUnifiedResources.ts
index dc22472b76..b3319b6f54 100644
--- a/frontend-modern/src/hooks/useUnifiedResources.ts
+++ b/frontend-modern/src/hooks/useUnifiedResources.ts
@@ -1518,6 +1518,7 @@ export function useUnifiedResources(options?: UseUnifiedResourcesOptions) {
const query = normalizeUnifiedResourcesQuery(options?.query ?? DEFAULT_UNIFIED_RESOURCES_QUERY);
const cacheKey = (options?.cacheKey || query || 'all').trim();
const initialHydration = options?.initialHydration ?? 'immediate';
+ const retainReadError = options?.retainReadError === true;
const enabled = options?.enabled ?? (() => true);
const realtimeEnabled = options?.realtimeEnabled ?? enabled;
const localFilter = parseUnifiedResourcesLocalFilter(query);
@@ -1556,7 +1557,7 @@ export function useUnifiedResources(options?: UseUnifiedResourcesOptions) {
const [facets, setFacets] = createSignal<UnifiedResourceFacets | null>(initialFacets);
const [loading, setLoading] = createSignal(!hasCachedResources);
const [error, setError] = createSignal<unknown>(
- options?.retainReadError ? cacheEntry.readError : undefined,
+ retainReadError ? cacheEntry.readError : undefined,
);
const wsStore = getGlobalWebSocketStore();
let refreshHandle: ReturnType<typeof setTimeout> | undefined;
@@ -1632,7 +1633,7 @@ export function useUnifiedResources(options?: UseUnifiedResourcesOptions) {
enrichCanonicalAllResourcesCache(allResourcesEntry, fetched);
entryForRequest.realtimeVersion = allResourcesEntry.realtimeVersion;
}
- if (options?.retainReadError) entryForRequest.readError = undefined;
+ if (retainReadError) entryForRequest.readError = undefined;
batch(() => {
applyResources(fetched, entryForRequest);
setError(undefined);
@@ -1640,8 +1641,8 @@ export function useUnifiedResources(options?: UseUnifiedResourcesOptions) {
return fetched;
} catch (err) {
if (isCurrentRequest()) {
- if (options?.retainReadError) entryForRequest.readError = err;
- if (!background || options?.retainReadError) setError(err);
+ if (retainReadError) entryForRequest.readError = err;
+ if (!background || retainReadError) setError(err);
}
throw err;
} finally {
@@ -2150,7 +2151,7 @@ export function useUnifiedResources(options?: UseUnifiedResourcesOptions) {
const scopedAggregations = cacheEntry.aggregations;
const scopedFacets = cacheEntry.facets;
batch(() => {
- setError(options?.retainReadError ? nextCacheEntry.readError : undefined);
+ setError(retainReadError ? nextCacheEntry.readError : undefined);
setResources(reconcile(scopedResources, { key: 'id' }));
setResourceSnapshotChange({ version: ++resourceSnapshotVersion, changedIds: null });
setPolicyPosture(scopedPolicyPosture);