Skip to content

useThrottleFn 第一次节流间隔不正确 #25

@junerver

Description

@junerver
val throttledFn = useThrottleFn(fn = { setStateFn(stateFn + 1) })
useEffect(stateFn) {
    println("$stateFn: ${Clock.System.now()}")
}

快速点击throttled+1 按钮,log显示第一次节流与第二次节流间隔为2s,与配置的 1s 不符

log输出:

0: 2024-09-04T02:39:11.650Z
1: 2024-09-04T02:39:17.302Z
2: 2024-09-04T02:39:19.416Z
3: 2024-09-04T02:39:20.426Z
4: 2024-09-04T02:39:21.446Z
5: 2024-09-04T02:39:22.552Z
6: 2024-09-04T02:39:23.562Z

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug(错误)Something isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions