[ice-plugin-store]: CSR下 dataloader里store调用reducer设置属性值, 组件访问不到最新的值
- Dominant language
- TypeScript
- Stars
- 18.6k
- Forks
- 2.1k
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the bug
在dataloader请求里 通过`store.getModelDispatchers('xxx').setSomeData(data)` 来设置data
组件里通过useModel获取data的值是旧的
### Expected behavior
获取到最新的值
目前一种临时方案 可以在路由根页面的useEffect里进行设值
### Actual behavior
_No response_
### Version of ice.js
1.2.6
### Content of build.json or ice.config.mts
_No response_
### Additional context
https://github.com/HomyeeKing/ice-repro
```bash
tnpm i
tnpm start
```
进入页面 打开控制台 会看见`hello world`的log,找到log所在请求,里面包含store更新信息,
按钮点击行为包含相同store更新代码,但是dataloader里不生效
Contributor guide
Research direction
Start with the linked ice-repro project and reproduce the issue using the provided install and start commands. Inspect the dataloader request that calls store.getModelDispatchers('xxx').setSomeData(data), compare it with the button's equivalent update and the route root page's useEffect workaround, and confirm that useModel receives the latest value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100