dva
dva copied to clipboard
app.unmodel 之后, dynamic 不会重复注册model
Code to reproduce the issue: (请提供可复现的代码或者步骤)
1,dynamic 注册一个model, 2,离开该组件时注销
componentWillUnmount() {
this.context.app.unmodel('direct');
}
3, 在进入该路由时 model 不会重复注册
建议: dynamic.js中 用本地的cache 去判断是否加载model,我建议应该实时从app中判断,这样会更符合预期。
Expected behavior: (预期的正常效果)
可以重复注册已 经注销的model
Actual behavior: (实际效果)
不会重复注册
Versions of packages used: (哪个库的哪个版本出现的问题)
请问有解决方法了吗
@sorrycc 是不是可以在Dynamic Wrapper 中 componentWillUnmount 这个钩子里自动注销model?
确实应该从app._models里去判断model是否已加载,我按楼主的建议修改了 dynamic.js的registerModel方法,可以实现unmodel后再次动态加载model
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.