Closed HECHONG999 closed 7 months ago
问题描述: `js const [ state ]= share({ xxx: undefined } )
const result = derive(() => { if( !state.xxx ) return; // 前置返回依赖收集会丢失 return state.xxx + 1; });
`
优化 https://heluxjs.github.io/helux/guide/derive 文档,提示用户依赖需提前声明,否则会照成依赖丢失 😅
准确的描述应该是所有依赖都需要提前申明
bad
const result = derive(() => { if( state.x ) return 2; return state.y + 1; });
ok
const result = derive(() => { const {x,y} = state; if(x ) return 2; y + 1; });
文档新增 derive 注意事项 https://heluxjs.github.io/helux/guide/derive#%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9
问题描述: `js const [ state ]= share({ xxx: undefined } )
const result = derive(() => { if( !state.xxx ) return; // 前置返回依赖收集会丢失 return state.xxx + 1; });
`
优化 https://heluxjs.github.io/helux/guide/derive 文档,提示用户依赖需提前声明,否则会照成依赖丢失 😅