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
{{ message }}
Repository navigation
fix: release the option lock when a delayed close is canceled - #1262
A canceled blur close keeps the popup open but leaves option updates locked: the list can retain 20 rows after receiving 40 options. The temporary lock introduced in #1193 should end when the current task completes.
Release that task's lock even when closing is canceled. Keep the task-id guard, canceled-close notification suppression, and scheduling unchanged. Hook tests cover controlled/uncontrolled cancellation, normal close, immediate reopen, and an older task finishing before a newer close.
Native keyboard reproduction on 1.12.0 source (fcbd87e), React 19.2.0
Click the input, type Option, Tab to Clear, optionally Shift+Tab back, then wheel-scroll the popup without clicking it. Before: only options 0–19 remain available. After: all 40 options are available and the popup stays open. Omitting Tab displays 40 in both versions. Verified with native keyboard/wheel input in Chromium 156.
Regression: npm test -- --runInBand -t useOpen fails on the old source and passes with the fix. Full tests with coverage (455 tests), lint, TypeScript, compile, changed-file formatting, and documentation build pass.
This change fixes the popup option list staying stale after blur and refocus by releasing the update lock when a delayed close is canceled. No remaining merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
标题“fix: release the option lock when a delayed close is canceled”描述了 PR 的主要变更:取消延迟关闭时释放选项锁。原始摘要说明 useOpen 在 cancelFun 返回 true 时仍调用 setLock(false),与标题一致。PR 目标也说明同一修复,且关联 issue #1260 要求相同行为。标题简洁、具体,没有使用…
Linked Issues check
[#1260] 要求:延迟关闭任务在 cancelFun() 返回 true 时,也必须释放选项锁,同时保留任务 ID 守卫。在 head 的 src/hooks/useOpen.ts 中,triggerUpdate 仍只在 id === taskIdRef.current 时执行。随后,无论 cancelFun() 结果如何,都会调用 setLock(false)。cancelFun() 返回 …
标题“fix: release the option lock when a delayed close is canceled”描述了 PR 的主要变更:取消延迟关闭时释放选项锁。原始摘要说明 useOpen 在 cancelFun 返回 true 时仍调用 setLock(false),与标题一致。PR 目标也说明同一修复,且关联 issue #1260 要求相同行为。标题简洁、具体,没有使用模糊词语。
Full details: Linked Issues check
Explanation
[#1260] 要求:延迟关闭任务在 cancelFun() 返回 true 时,也必须释放选项锁,同时保留任务 ID 守卫。在 head 的 src/hooks/useOpen.ts 中,triggerUpdate 仍只在 id === taskIdRef.current 时执行。随后,无论 cancelFun() 结果如何,都会调用 setLock(false)。cancelFun() 返回 true 时只跳过 triggerEvent,锁仍会释放。过期任务因 ID 不匹配而不会解锁,满足“旧任务不得解锁新关闭”的要求。[#1175][#1193] 仅作为背景,不产生额外编码要求。PR 描述中提到的 useOpen 测试覆盖取消关闭、正常关闭、立即重开和旧任务晚完成等场景。本次仅基于源码和 PR 摘要确认行为,未读取测试文件内容。
Finishing Touches
Generate unit tests (beta)
Create a new PR
Fix failing CI checks
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: f07f3383-a076-4195-a3ea-2719425a8bd1
Commits
Reviewing files that changed from the base of the PR and between fcbd87e and 2f37d4b.
Files selected for processing: 2
src/hooks/useOpen.ts
tests/Hooks.test.tsx
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A canceled blur close keeps the popup open but leaves option updates locked: the list can retain 20 rows after receiving 40 options. The temporary lock introduced in #1193 should end when the current task completes.
Release that task's lock even when closing is canceled. Keep the task-id guard, canceled-close notification suppression, and scheduling unchanged. Hook tests cover controlled/uncontrolled cancellation, normal close, immediate reopen, and an older task finishing before a newer close.
Native keyboard reproduction on 1.12.0 source (fcbd87e), React 19.2.0
Click the input, type
Option, Tab to Clear, optionally Shift+Tab back, then wheel-scroll the popup without clicking it. Before: only options 0–19 remain available. After: all 40 options are available and the popup stays open. Omitting Tab displays 40 in both versions. Verified with native keyboard/wheel input in Chromium 156.Regression:
npm test -- --runInBand -t useOpenfails on the old source and passes with the fix. Full tests with coverage (455 tests), lint, TypeScript, compile, changed-file formatting, and documentation build pass.Closes #1260.
Prepared by an automated contribution pipeline that I build and operate (https://github.com/clean99/software-factory); the tests and evidence above were produced by it.
Summary by CodeRabbit