Merge pull request #515 from pascalorg/fix/preload-tool-inspector

Preload the selected tool inspector
This commit is contained in:
Aymeric Rabot
2026-07-19 17:40:32 +02:00
committed by GitHub
@@ -43,7 +43,12 @@ function getRegistryTool(tool: Tool | null): ComponentType | null {
if (!def?.tool) return null if (!def?.tool) return null
const cached = lazyToolCache.get(def.tool) const cached = lazyToolCache.get(def.tool)
if (cached) return cached if (cached) return cached
const Comp = lazy(def.tool as () => Promise<{ default: ComponentType }>) const Comp = lazy(async () => {
// A placed node is selected immediately. Resolve its custom inspector with
// the tool so that selection cannot introduce a second async boundary.
const [module] = await Promise.all([def.tool!(), def.parametrics?.customPanel?.()])
return module as { default: ComponentType }
})
lazyToolCache.set(def.tool, Comp) lazyToolCache.set(def.tool, Comp)
return Comp return Comp
} }