Uh oh!
There was an error while loading. Please reload this page.
fix(deps): 模态表单里 lookup 搜索框聚焦即被夺回——补丁修复 focus-scope 栈驱逐竞态 (#3183) - #3184
Closed
baozhoutao wants to merge 1 commit into
Closed
fix(deps): 模态表单里 lookup 搜索框聚焦即被夺回——补丁修复 focus-scope 栈驱逐竞态 (#3183)#3184baozhoutao wants to merge 1 commit into
baozhoutao wants to merge 1 commit into
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
产线 console 里,新建/编辑模态中 lookup 快捷下拉的搜索框和 Record Picker
表格弹窗都无法输入:焦点在 focusout 阶段就被外层 Dialog 的 FocusScope
同步拽回触发按钮,列表永不过滤("新建记录时 lookup 无法搜索")。
根因是 @radix-ui/react-focus-scope@1.1.16(上游最新 rc 同样存在)的竞态:
栈管理 effect 的 cleanup 用 setTimeout(0) 延迟执行
focusScopesStack.remove(scope)。当该 effect 因 container ref 抖动在组件
未卸载时重跑,顺序变成"重跑先 add → 旧 cleanup 的延时 remove 后执行",
刚加回去的 scope 被永久踢出栈——dialog 的陷阱监听器还活着,却再也没有
弹层能 pause 它。vite dev 不触发该抖动,所以只有产线 bundle 复现。
pnpm patch:effect 重跑(scope 存活)时取消挂起的延时驱逐;真实卸载路径
(autofocus-on-unmount + 栈移除)不变。回归测试用 asChild 子元素换 key
确定性复现竞态:未打补丁必红。已在 rc.1 后端 + 修复后产线 console 真机
验证下拉与表格弹窗搜索均恢复。
Closes#3183
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>os-zhuang
commented
Aug 2, 2026
Contributor
已 重新开发并合并 |
akarma-synetal pushed a commit
to akarma-synetal/objectui
that referenced
this pull request
Aug 3, 2026
…说明 (objectstack-ai#3200) * fix(deps): 模态表单里 lookup 搜索框聚焦即被夺回——补丁修复 focus-scope 栈驱逐竞态 (objectstack-ai#3183) 产线 console 里,新建/编辑模态中 lookup 快捷下拉的搜索框和 Record Picker 表格弹窗都无法输入:焦点在 focusout 阶段就被外层 Dialog 的 FocusScope 同步拽回触发按钮,列表永不过滤("新建记录时 lookup 无法搜索")。 根因是 @radix-ui/react-focus-scope@1.1.16(上游最新 rc 同样存在)的竞态: 栈管理 effect 的 cleanup 用 setTimeout(0) 延迟执行 focusScopesStack.remove(scope)。当该 effect 因 container ref 抖动在组件 未卸载时重跑,顺序变成"重跑先 add → 旧 cleanup 的延时 remove 后执行", 刚加回去的 scope 被永久踢出栈——dialog 的陷阱监听器还活着,却再也没有 弹层能 pause 它。vite dev 不触发该抖动,所以只有产线 bundle 复现。 pnpm patch:effect 重跑(scope 存活)时取消挂起的延时驱逐;真实卸载路径 (autofocus-on-unmount + 栈移除)不变。回归测试用 asChild 子元素换 key 确定性复现竞态:未打补丁必红。已在 rc.1 后端 + 修复后产线 console 真机 验证下拉与表格弹窗搜索均恢复。 Closesobjectstack-ai#3183 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs(deps): 记录 focus-scope 补丁的存废条件,并把 changeset/注释改回英文 合并 main 后的补充: - 新增 patches/README.md —— 本仓首次引入 pnpm patchedDependencies,而「为什么打、 什么时候删」此前只写在 PR 描述里,合并后即消失。README 记下上游 issue、删除条件 (上游在 effect 重跑时取消挂起的驱逐)、编辑/删除补丁的操作,以及「版本号一变补丁 失配就直接让 pnpm install 失败」这一刻意为之的响亮失败。 - changeset 与测试文件顶部注释里的中文改为英文 —— AGENTS.md 准则 #-1 要求代码注释与 文档(changeset 会进 CHANGELOG,随 npm 发布)一律英文。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NUhj4LiXcXGT93m3683KFK --------- Co-authored-by: 包周涛 <baozhoutao@hotoa.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
问题
产线构建的 console(如
@objectstack/console@17.0.0-rc.1)中,新建/编辑记录的模态表单里 lookup 字段无法搜索:仅产线 bundle 复现,
vite dev(HMR)正常,因此现有测试与日常开发均未暴露。Closes#3183。根因
@radix-ui/react-focus-scope@1.1.16(上游最新 rc 同样存在)的栈驱逐竞态:setTimeout(0)延迟执行focusScopesStack.remove(scope);add→ 旧 cleanup 的延时remove后执行」,刚加回去的 scope 被永久踢出栈;pause它 → 弹层内输入框的焦点永远被同步夺回。排查过程(服务端排除、浏览器插桩、fiber 状态挖掘)详见 #3183。
修复
pnpm patch(patches/@radix-ui__react-focus-scope.patch):clearTimeout取消上一次 cleanup 挂起的延时驱逐;验证
packages/components/src/__tests__/dialog-popover-focus-scope.test.tsx:用「asChild 子元素换 key → container ref 重挂 → effect 必然重跑」确定性复现竞态,未打补丁必红、打补丁转绿(已双向验证);另附 Dialog+Popover 集成用例与陷阱恢复用例。zzz→「未找到选项」、Dev→正确过滤;Record Picker 弹窗搜索恢复;showcase 后端 + 修复版产线构建同样验证通过。备注
@object-ui/components的第三方需等上游修复。🤖 Generated with Claude Code