fix: add null safety checks for resources() in useResourcesAsLegacy
Prevents errors when resources array is undefined during initial load.
This commit is contained in:
parent
4ad8235f7a
commit
7eb6d33dad
1 changed files with 5 additions and 5 deletions
|
|
@ -246,13 +246,13 @@ export function useResourcesAsLegacy() {
|
|||
// by id in the WebSocket store (stable identities, fine-grained updates).
|
||||
// Only synthesize legacy types from unified resources when it looks like the backend
|
||||
// isn't providing that legacy field (e.g., resources include the type but legacy array is empty).
|
||||
const hasVmResources = createMemo(() => resources().some((r) => r.type === 'vm'));
|
||||
const hasNodeResources = createMemo(() => resources().some((r) => r.type === 'node'));
|
||||
const hasVmResources = createMemo(() => (resources() || []).some((r) => r.type === 'vm'));
|
||||
const hasNodeResources = createMemo(() => (resources() || []).some((r) => r.type === 'node'));
|
||||
const hasContainerResources = createMemo(() =>
|
||||
resources().some((r) => r.type === 'container' || r.type === 'oci-container'),
|
||||
(resources() || []).some((r) => r.type === 'container' || r.type === 'oci-container'),
|
||||
);
|
||||
const hasHostResources = createMemo(() => resources().some((r) => r.type === 'host'));
|
||||
const hasDockerHostResources = createMemo(() => resources().some((r) => r.type === 'docker-host'));
|
||||
const hasHostResources = createMemo(() => (resources() || []).some((r) => r.type === 'host'));
|
||||
const hasDockerHostResources = createMemo(() => (resources() || []).some((r) => r.type === 'docker-host'));
|
||||
|
||||
// Convert resources to legacy VM format
|
||||
// Falls back to legacy state.vms array when unified resources aren't yet populated
|
||||
|
|
|
|||
Loading…
Reference in a new issue