effects中 actions.routing改变hash但是没触发渲染
Closed this issue · 2 comments
dpshen commented
mirror.defaults({
historyMode: "hash"
})
不经过model,用户触发的事件中执行actions.routing.replace没任何问题
effects中执行actions.routing.replace 地址栏中的hash改变,redux-tools看到有一次@@router/LOCATION_CHANGE但是没有渲染,停留在之前的界面
但是如果重复写一行actions.routing.replace 界面就会渲染,redux-tools看到有两次@@router/LOCATION_CHANGE,其中一次显示(states are equal)
会不会是我有什么小细节没注意,配置没配好?
llh911001 commented
这个现象,猜测可能的原因是:
如果 route 组件是 与 router 存在嵌套关系,但你的 route 层的组件 又 connect 了 store 订阅了某些 state。当你去触发路由跳转的时候,你会发现并没有触发路由的render。原因是:一旦子路由被嵌套了,子路由无法获取 router 的 context 上的 props 了
具体可参看 这里的文档说明。
dpshen commented
确实是这个问题