Skip to content

docs: 更新文档的链接,增加使用 react-query v4的推荐配置 #12892

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Umi Contributing Guide

Checkout [docs/docs/introduce/contributing.md](docs/docs/introduce/contributing.md) for the full guide.
Checkout [docs/docs/docs/introduce/contributing.md](docs/docs/docs/introduce/contributing.md) for the full guide.
5 changes: 4 additions & 1 deletion docs/docs/docs/max/react-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,13 @@ export const reactQuery: RuntimeReactQueryType = {
queries: {
// 🟡 此配置具有的表现往往令人出乎意料,若无特殊需求,请默认关闭
refetchOnWindowFocus: false,
// 🟡 如果是 v4 版本react-query,networkMode 推荐设置为 'always'
networkMode: 'always',
},
},
},
};
```

注:绝大多数项目中,**你都应该默认设定 `refetchOnWindowFocus: false`** ,否则将引发出人意料的反复获取数据效果(这在 SWR 中被称为 [`revalidateOnFocus`](https://swr.vercel.app/zh-CN/docs/api#options) )。
注:绝大多数项目中,**你都应该默认设定 `refetchOnWindowFocus: false`** ,否则将引发出人意料的反复获取数据效果(这在 SWR 中被称为 [`revalidateOnFocus`](https://swr.vercel.app/zh-CN/docs/api#options) )。如果没有手动安装 v5 版本的 `@tanstack/react-query` 依赖,那么默认使用的是 v4 版本,**如无特殊需求建议设置 `networkMode: 'always'`** ,否则将引发出人意料的效果,详见[issue](https://github.com/TanStack/query/issues/5679)。