refactor: make tanstack query's network mode option to always (#3928)

#### What type of PR is this?

/kind improvement
/area core
/milstone 2.6.x

#### What this PR does / why we need it:

将 TanStack Query 的 Network Mode 设置为 always,防止在无网络的情况下,开发环境也无法请求数据。

#### Special notes for your reviewer:

测试方式:断网之后使用开发模式访问 Console,观察请求是否正常发送即可。

#### Does this PR introduce a user-facing change?

```release-note
None
```
pull/3926/head^2
Ryan Wang 2023-05-11 10:44:20 +08:00 committed by GitHub
parent c0c1806476
commit 9a52cebd1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -4,11 +4,17 @@ import {
type VueQueryPluginOptions,
} from "@tanstack/vue-query";
const networkMode = import.meta.env.PROD ? "online" : "always";
const options: VueQueryPluginOptions = {
queryClientConfig: {
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
networkMode,
},
mutations: {
networkMode,
},
},
},