From 9b512e110fd2e82f8cc5d4a5df7c82fb1dcdae45 Mon Sep 17 00:00:00 2001 From: David Montero Crespo Date: Tue, 21 Jul 2026 17:06:15 +0200 Subject: [PATCH] fix(registry): resolve brand-prefixed metadata ids (wokwi-lcd2004 -> lcd2004) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gallery templates and agent-loaded projects can store element tag names ("wokwi-lcd2004") where the registry keys by the bare id ("lcd2004"). getById now falls back to the stripped id, so such a component renders instead of sitting invisible in the store — a real agent session shipped an LCD counter whose LCD existed in the store, was wired and validated, and simply never appeared on the canvas. Co-Authored-By: Claude Fable 5 --- frontend/src/services/ComponentRegistry.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/frontend/src/services/ComponentRegistry.ts b/frontend/src/services/ComponentRegistry.ts index 3a65e544..093a7e41 100644 --- a/frontend/src/services/ComponentRegistry.ts +++ b/frontend/src/services/ComponentRegistry.ts @@ -286,7 +286,15 @@ export class ComponentRegistry { * Get component by ID */ getById(id: string): ComponentMetadata | undefined { - return this.metadata.get(id); + const hit = this.metadata.get(id); + if (hit) return hit; + // Brand-prefix fallback: gallery templates and older agent-loaded + // projects store element tag names ("wokwi-lcd2004") where the registry + // keys by the bare id ("lcd2004"). Without this, such a component sits + // in the store, gets saved and wired — but never renders, so the user + // sees a circuit whose display simply does not exist on screen. + const bare = id.replace(/^(wokwi|velxio)-/, ''); + return bare !== id ? this.metadata.get(bare) : undefined; } /**