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

fix: useRequest cache not reset stale error #1860

Merged
merged 1 commit into from
Sep 8, 2022

Conversation

kongmoumou
Copy link
Contributor

@kongmoumou kongmoumou commented Sep 3, 2022

[中文版模板 / Chinese template]

@miracles1919 可以帮忙 review 下这个 PR 嘛 😂

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

#1859

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English fix useRequest cache not reset stale error
🇨🇳 Chinese 修复 useRequest 返回缓存时不重置 error

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

@CLAassistant
Copy link

CLAassistant commented Sep 3, 2022

CLA assistant check
All committers have signed the CLA.

@miracles1919 miracles1919 changed the title fix: useRequest cache not reset stale error close #1859 fix: useRequest cache not reset stale error Sep 7, 2022
@brickspert
Copy link
Collaborator

我觉得这个问题不能这么解决。

你这个不是 error 被缓存了,而是因为你动态改变了 cacheKey,其实目前 useRequest 是不支持动态 cacheKey 的,这是出问题的本质原因。

所以需要解决的其实是 useRequest 如何支持动态 cacheKey,当 cacheKey 变化的时候,要完全清除掉上一个 cacheKey 的全部数据。

@brickspert
Copy link
Collaborator

支持动态 cacheKey 可能需要全局来考虑一下

@kongmoumou
Copy link
Contributor Author

但是目前 error 不清除很明显不符合预期吧 😂,据我了解身边蛮多人都是当动态 cacheKey 来用的 🤔,可以先 fix 这个问题后续再完善么~

@brickspert
Copy link
Collaborator

先临时合并下,后面我们来处理下动态 cacheKey 的问题。

本质上就是 cacheKey 只缓存了 data,其它 return 的东西都是保持不变的。

@brickspert brickspert merged commit 9d7cc2f into alibaba:master Sep 8, 2022
@kongmoumou
Copy link
Contributor Author

想问下大概什么时候发版呢~

@brickspert
Copy link
Collaborator

想问下大概什么时候发版呢~

没意外的话,今天会发一个版本。

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

Successfully merging this pull request may close these issues.

None yet

4 participants