refactor(canvas): ProvisioningTimeout uses pruneStaleKeys helper

Follow-up to #2110 (which generalised pruneStaleKeys to Map<string, T>).
Identified by the simplify reviewer on that PR as the only other
in-tree caller of the same shape: `for (const id of map.keys()) { if
(!liveIds.has(id)) map.delete(id); }`.

Net: -3 lines, one less hand-rolled GC loop. No behaviour change —
the helper does exactly what the inline block did.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
rabbitblood 2026-04-26 14:05:28 -07:00
parent b007d8ac73
commit 5d888abc41

View File

@ -2,6 +2,7 @@
import { useState, useEffect, useCallback, useRef, useMemo } from "react";
import { useCanvasStore, type WorkspaceNodeData } from "@/store/canvas";
import { pruneStaleKeys } from "./canvas/useCanvasViewport";
import { api } from "@/lib/api";
import { showToast } from "./Toaster";
import { ConsoleModal } from "./ConsoleModal";
@ -125,11 +126,7 @@ export function ProvisioningTimeout({
// Remove tracking for nodes that are no longer provisioning
const activeIds = new Set(parsedProvisioningNodes.map((n) => n.id));
for (const id of tracking.keys()) {
if (!activeIds.has(id)) {
tracking.delete(id);
}
}
pruneStaleKeys(tracking, activeIds);
// Also remove from timedOut list if no longer provisioning, and
// clear `dismissed` entries for workspaces that finished so a