fengyuan

Results 3 issues of fengyuan

现象:配置 approuter prefetch 后,实际未预加载微应用 router 相关资源 原因定位:AppRouter 内部在 construct 时,解析 React.children,进行微应用的 prefetch,这要求在 AppRouter 在构建时就需要提供所有微应用的 child。 修复方式:修改 @ice/plugin-icestark 插件中,对 AppRouter 的渲染方式,传入 apps,在 AppRouter 中,判定 apps 变化,做 prefetch。 --- 构造方法时 prefetch https://github.com/ice-lab/icestark/blob/master/packages/icestark/src/AppRouter.tsx#L79...

# 修复微模块的 targetNode 为 null 的问题 现象:微模块的 mount API 无法获取 targetNode 原因定位:通过日志方式呈现,最终定位原因为 **setState 后的执行时序问题** ![image](https://github.com/ice-lab/icestark/assets/13255714/b7edcd65-dc8d-41e4-99fa-eaf26a9df502) ![image](https://github.com/ice-lab/icestark/assets/13255714/510306e1-ec95-46a3-b7ff-5a353b340477) 最终执行时序 ![image](https://github.com/ice-lab/icestark/assets/13255714/33c4fe4a-e9b4-4340-854c-41eec445556a) 修复方式:通过将后续的 mount 逻辑放到 setState 回调,保证此时 this.mountNode 是成功赋值的状态 ![image](https://github.com/ice-lab/icestark/assets/13255714/d295fd08-4855-4bb3-8bf0-5d653b1ed9ea) 最终执行时序正常,问题修复 ![image](https://github.com/ice-lab/icestark/assets/13255714/8c1aa55e-3030-452f-98a6-f16104c21d8e)

联动修改:https://github.com/ice-lab/icestark/pull/732