fix(editor): preload selected tool inspector

This commit is contained in:
Aymeric Rabot
2026-07-19 17:35:45 +02:00
parent c0a5db935e
commit 2129eed0c2
@@ -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
} }