Skip to content

fix(omi-vueify): refresh Omi children after Vue slot updates - #1000

Open
dvd233 wants to merge 1 commit into
Tencent:masterfrom
dvd233:codex/fix-vueify-slot-update-997
Open

dvd233 wants to merge 1 commit into
Tencent:masterfrom
dvd233:codex/fix-vueify-slot-update-997

Conversation

@dvd233

@dvd233 dvd233 commented Sep 14, 2026

Copy link
Copy Markdown

背景

当 Vue 中的条件具名 slot 从空变为有内容时,omi-vueify 会更新 Web Component 的 light DOM,但 Omi 组件可能仍保留初始化时的 props.children。依赖 slot 内容的组件 UI 因此保持旧状态,直到下一次 Omi 更新才显示。

修复

  • 在 Vue wrapper 的 onUpdated 钩子中等待 DOM patch 完成;
  • 清除已发布 Omi 版本使用的 props.children 缓存,并调用 Omi 的公开 update() 方法重新读取 light-DOM children;
  • 对没有 update() 方法的元素保持 no-op;
  • 增加具名 slot 增加和移除的回归测试。

验证

  • npx jest test/vueify.test.jsx --runInBand --testNamePattern='slots':4/4 passed;
  • npm run build(Vite + TypeScript):通过;
  • npx eslint --config ../omi/.eslintrc.cjs --rule 'semi: off' ../omi-vueify/src/index.ts ../omi-vueify/test/vueify.test.jsx:通过;
  • git diff --check:通过;
  • 完整 Jest 套件:22 项通过,1 个未修改的既有非 kebab-case 事件断言失败。

Fixes #997

AI assistance disclosure

Codex assisted with investigation and test drafting. I reviewed the complete diff and verified the behavior and build locally.

@tencent-adm

Copy link
Copy Markdown
Member

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

omi-vueify包的chatbot组件里slot发生变更时不会触发webc父组件的更新

2 participants