byte-fe / react-model

The next generation state management library for React
236 stars 23 forks source link

页面跳转时会存在一定几率的报错,特别是面包屑导航一层层回退时 #83

Closed zhangjianseu closed 5 years ago

zhangjianseu commented 5 years ago

TypeError: Cannot read property 'state' of undefined j node_modules/react-model/dist/react-model.js:253 250 | }), e; 251 | }, 252 | j = function j(t, e) {

253 | var r = n.useState(o.State[t].state)[1]; 254 | o.uid += 1; 255 | var c = "" + o.uid; 256 | o.Setter.functionSetter[t] || (o.Setter.functionSetter[t] = {}), o.Setter.functionSetter[t][c] = { View compiled WorkSpaceList src/views/Pages/WorkSpace/List/index.tsx:16 13 | star: boolean, 14 | members: string[] 15 | } 16 | const WorkSpaceList = () => { 17 | const [newDialogVisible, setNewDialogVisible] = useState(false); 18 | const [state, actions] = useStore('WorkSpaceList'); 19 |

ArrayZoneYour commented 5 years ago

可以提供下复现问题的Codesandbox或者仓库地址吗?react-model是不是最新版本?

可能是你的Model方法执行滞后了 也可能是你回退导航时页面被刷新了,但是Model初始化的代码并没有执行,即model的状态没有持久化。

总而言之,需要你提供更完整的信息来定位问题😂