Skip to content

Commit 868542a

Browse files
committed
🐛: fix, call wrong refresh fun
1 parent daad091 commit 868542a

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

hooks/src/main/kotlin/xyz/junerver/compose/hooks/userequest/plugins/usePollingPlugin.kt

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,6 @@ class PollingPlugin<TData : Any> : Plugin<TData>() {
5858
}
5959
val pluginScope = this
6060

61-
// 替换run函数为循环执行
62-
// fetch.run = {
63-
// scope.launch {
64-
// while (isActive) {
65-
// fetch._run(it)
66-
// delay(pollingInterval)
67-
// }
68-
// }.also { pollingJob = it }
69-
// }
70-
7161
object : PluginLifecycle<TData>() {
7262
override val onBefore: ((TParams) -> OnBeforeReturn<TData>?)
7363
get() = {
@@ -91,7 +81,7 @@ class PollingPlugin<TData : Any> : Plugin<TData>() {
9181
if (pollingErrorRetryCount == -1 || count <= pollingErrorRetryCount) {
9282
usedScope.launch(Dispatchers.IO) {
9383
delay(pollingInterval)
94-
fetch.refreshAsync()
84+
if (pollingWhenHidden) fetch.refreshAsync() else fetch.refresh()
9585
}.also { pollingJob = it }
9686
} else {
9787
count = 0

0 commit comments

Comments
 (0)