From 5d888abc41ec597def12a8e0fa266694af9c26f5 Mon Sep 17 00:00:00 2001 From: rabbitblood Date: Sun, 26 Apr 2026 14:05:28 -0700 Subject: [PATCH] refactor(canvas): ProvisioningTimeout uses pruneStaleKeys helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up to #2110 (which generalised pruneStaleKeys to Map). 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) --- canvas/src/components/ProvisioningTimeout.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/canvas/src/components/ProvisioningTimeout.tsx b/canvas/src/components/ProvisioningTimeout.tsx index 92af73f0..9e7e2d17 100644 --- a/canvas/src/components/ProvisioningTimeout.tsx +++ b/canvas/src/components/ProvisioningTimeout.tsx @@ -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