You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Whether to continue polling when the page is hidden. If set to false, polling will be temporarily stopped when the page is hidden, and will continue the last polling when the page is displayed again.
75
75
*/
76
76
@Stable
77
77
varpollingWhenHidden:Boolean = false,
78
78
/**
79
-
* 轮询错误重试次数。如果设置为 -1,则无限次
79
+
* Number of polling error retries. If set to -1, retry infinitely
* When [manual]=false (automatic request mode), every time [ready] changes from false to true, a request will be automatically initiated with the parameter options.[defaultParams].
89
+
* When [manual]=true (manual request mode), as long as [ready]=false, requests triggered by run/runAsync will not be executed.
* By setting options.[refreshDeps], when dependencies change, [useRequest] will automatically call the [Fetch.refresh] method to achieve the effect of refreshing (repeating the last request).
94
+
* If options.[manual] = true is set, [refreshDeps] will no longer take effect
* If there is a dependency refresh Action function, the default [Fetch.refresh] function will not be executed, and [refreshDepsAction] will be executed instead
* Unique identifier for the request. Data with the same cacheKey is globally synchronized (cacheTime and staleTime parameters will disable this mechanism)
103
103
*/
104
104
@Stable
105
105
varcacheKey:String = "",
106
106
/**
107
-
* 设置缓存数据回收时间。默认缓存数据 5 分钟后回收
108
-
* 如果设置为 `(-1).seconds`, 则表示缓存数据永不过期
107
+
* Set cache data recycle time. By default, cache data is recycled after 5 minutes
108
+
* If set to `(-1).seconds`, it means cache data never expires
109
109
*/
110
110
@Stable
111
111
varcacheTime:Duration = 5.minutes,
112
112
/**
113
-
* 缓存数据保持新鲜时间。在该时间间隔内,认为数据是新鲜的,不会重新发请求
114
-
* 如果设置为 `(-1).seconds`,则表示数据永远新鲜
113
+
* Cache data freshness time. Within this time interval, the data is considered fresh and no new request will be made
114
+
* If set to `(-1).seconds`, it means the data is always fresh
115
115
*/
116
116
@Stable
117
117
varstaleTime:Duration = Duration.ZERO,
118
118
/**
119
-
* 自定义缓存策略,无则采取默认策略
119
+
* Custom cache strategy, if none, use default strategy
* By setting options.[loadingDelay], you can delay the time when [FetchState.loading] becomes true, effectively preventing flickering.
127
+
* For example, when an interface normally returns quickly, if we use it conventionally, flickering will occur. After the request is initiated, it changes very quickly from false -> true -> false;
128
+
* We can set a [loadingDelay] that is greater than this return duration, such as [50.milliseconds], so that interfaces that return within 50ms will not cause flickering.
129
+
* This flickering actually has another variant scenario, for example, an interface will return very quickly, we don't want users to continue clicking quickly, we expect to delay loading and increase the external performance time of loading, this requirement is close to throttling, but slightly different
131
130
*/
132
131
@Stable
133
132
varloadingDelay:Duration = Duration.ZERO,
@@ -141,13 +140,13 @@ data class UseRequestOptions<TParams, TData> internal constructor(
0 commit comments