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

带参数详情页面多份数据缓存如何做? #152

Open
yangjunpeng1993 opened this issue Aug 3, 2022 · 4 comments
Open

带参数详情页面多份数据缓存如何做? #152

yangjunpeng1993 opened this issue Aug 3, 2022 · 4 comments

Comments

@yangjunpeng1993
Copy link

您好。
我们从列表页跳转至详情页,详情页需要通过网络请求数据,数据量比较大,所以在多个页签之间切换时会频繁请求网络数据。
我用了 multiple,但是如果不在 update 生命周期里面做更新,永远只能显示同样的缓存内容。我的疑问是如何判断当前页面应该走缓存还是走网络请求。

@xushijie10086
Copy link

同问

@CJY0208
Copy link
Owner

CJY0208 commented Aug 15, 2022

意思是用了 multiple 还是不能缓存多份,需要手动通过 update 重新请求数据吗?能否提供复现用例

@withzhaoyu
Copy link

同问 请问怎么解决的

@xushijie10086
Copy link

这个库是真的很强大,文档也挺详细, 我已经完美实现了keep-alive的功能。

const renderCacheRoutes = () => routeList.map(({ component, path }, index) => ( <CacheRoute exact path={path} cacheKey={(props) => props.location?.pathname} when={'always'} key={path} multiple component={component} > </CacheRoute> ))

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