fix(registry): resolve brand-prefixed metadata ids (wokwi-lcd2004 -> lcd2004)
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 <noreply@anthropic.com>
This commit is contained in:
parent
8c1bbbc1a7
commit
9b512e110f
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue