diff --git a/src/features/Conversation/Plugins/Inspector/index.tsx b/src/features/Conversation/Plugins/Inspector/index.tsx index 5875f02998cd..2e274dc53fe8 100644 --- a/src/features/Conversation/Plugins/Inspector/index.tsx +++ b/src/features/Conversation/Plugins/Inspector/index.tsx @@ -118,7 +118,7 @@ const Inspector = memo( label: t('debug.response'), }, ]} - style={{ maxWidth: 800 }} + style={{ display: 'grid', maxWidth: 800 }} /> )} diff --git a/src/features/Conversation/Plugins/Render/DefaultType/SystemJsRender/index.tsx b/src/features/Conversation/Plugins/Render/DefaultType/SystemJsRender/index.tsx index 5d91df0c5d1f..c374dd3886d9 100644 --- a/src/features/Conversation/Plugins/Render/DefaultType/SystemJsRender/index.tsx +++ b/src/features/Conversation/Plugins/Render/DefaultType/SystemJsRender/index.tsx @@ -8,18 +8,23 @@ interface SystemJsRenderProps extends PluginRenderProps { url: string; } +const RenderCache: { + [url: string]: PluginRender; +} = {}; + const SystemJsRender = memo(({ url, ...props }) => { - const [component, setComp] = useState(null); + const [component, setComp] = useState(RenderCache[url]); useEffect(() => { system .import(url) .then((module1) => { setComp(module1.default); + RenderCache[url] = module1.default; // 使用module1模块 }) .catch((error) => { - setComp(null); + setComp(undefined); console.error(error); }); }, [url]);