Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useDidRecover回调里面如何拿到最新的state #115

Open
xiasiyong opened this issue Jun 10, 2021 · 6 comments
Open

useDidRecover回调里面如何拿到最新的state #115

xiasiyong opened this issue Jun 10, 2021 · 6 comments

Comments

@xiasiyong
Copy link

image
视图里面的cocunt已经变成5了,但是在useDidRecover打印出来的还是0

@xiasiyong
Copy link
Author

xiasiyong commented Jun 10, 2021

场景:
订单列表页通过筛选条件搜索出订单
从列表页跳转到订单详情页,编辑完之后返回
需要保留之前的筛选条件,并且刷新列表的数据
我在useDidRecover里面,拿不到之前的筛选状态

@CJY0208
Copy link
Owner

CJY0208 commented Jun 11, 2021

cache-router 版本换成 v1.11.1,然后增加 deps 试试,如下

useDidRecover(..., [count])

@CJY0208 CJY0208 closed this as completed Jul 13, 2021
@nainai-wdd
Copy link

useDidRecover(()=>console.log(count), [count])
所需要的state列表,放到第二个数组参数里

@CJY0208
Copy link
Owner

CJY0208 commented Oct 9, 2021

其实感觉不应该需要 deps 数组,保持 effect 函数最新是关键,我重开下下 mark

@CJY0208 CJY0208 reopened this Oct 9, 2021
@live680g
Copy link

useDidRecover(()=>console.log(count), [count]) 所需要的state列表,放到第二个数组参数里

solved problem in this way, thx.

1 similar comment
@live680g
Copy link

useDidRecover(()=>console.log(count), [count]) 所需要的state列表,放到第二个数组参数里

solved problem in this way, thx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants