icestark icon indicating copy to clipboard operation
icestark copied to clipboard

fix:mount node null

Open huxfy opened this issue 11 months ago • 1 comments

修复微模块的 targetNode 为 null 的问题

现象:微模块的 mount API 无法获取 targetNode 原因定位:通过日志方式呈现,最终定位原因为 setState 后的执行时序问题 image image

最终执行时序 image

修复方式:通过将后续的 mount 逻辑放到 setState 回调,保证此时 this.mountNode 是成功赋值的状态 image

最终执行时序正常,问题修复 image

huxfy avatar Mar 18 '24 09:03 huxfy

补充下复现场景的 demo,方便增加测试用例

ClarkXia avatar Mar 18 '24 10:03 ClarkXia