[Question]rax小程序应用状态管理时在页面回退到生一个页面后获取不到状态管理里面保存的值
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 8k
- Forks
- 611
- PR merge metrics
- No merged PRs in 30d
Description
参照这个文档的步骤,在项目里面添加了状态管理用户相关信息
https://rax.js.org/docs/guide/miniapp-store
Home页面
export default function Home() {
const [userState, userDispatchers] = store.useModel('user');
useEffect(() => {
//这里异步获取用户信息并使用userDispatchers.update({userInfo}) 保管用户信息
}
}
页面上按钮点击时通过history.push('/otherPage')跳转到其他页面, 在这个otherPage上点击返回按钮返回到Home页面,使用userState时得到undefined? 为什么会这个样子,期望帮忙解答一下这个问题
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the miniapp-store guide and the Home/otherPage flow shown in the report; reproduce the userDispatchers.update call, history.push navigation, and return while observing userState. Compare the store lifecycle across these page transitions and record the confirmed cause and expected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100