[Bug]: 'Fix debouncing ' solution doesn't work
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 11.8k
- 派生
- 7.9k
- 平均合并
- 1 天 11 小时
- 30 天内合并 PR
- 11
描述
Summary
https://react.dev/learn/referencing-values-with-refs#fix-debouncing --> Solution --> Try provided solution: Only the last button handler fires after debouncing.
Page
https://react.dev/learn/referencing-values-with-refs#fix-debouncing
Details
https://react.dev/learn/referencing-values-with-refs#fix-debouncing --> Solution --> Try provided solution: Only the last button handler fires after debouncing.
The solution via using useRef doesn't work and has the same issue as in the challenge description: "This example works, but not quite as intended. The buttons are not independent. To see the problem, click one of the buttons, and then immediately click another button. You’d expect that after a delay, you would see both button’s messages. But only the last button’s message shows up. The first button’s message gets lost."
Only the last button handler fires after debouncing.
Checked on:
Win11, Chrome Version 141.0.7390.123 (Official Build) (64-bit)
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 React 文档中链接的“Fix debouncing”部分开始,通过快速连续点击两个按钮来复现示例。跟踪所提供的解决方案,并验证这两个按钮是否彼此独立地进行 debounce;当两个延迟消息都出现,而不是只有最后一条消息出现时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, react
- 领域
- documentation
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100