fix(playground): inject Vue cardIdSymbol for Angular saveState - #264
Conversation
Angular renderer and Vue Chat used different Symbol instances for card id, so saveState could not locate the message. Bind cardId into actions at the playground Angular bridge. Co-authored-by: Cursor <cursoragent@cursor.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review. WalkthroughThe Vue chat package now exports ChangesCard ID context propagation
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: 🔵 Low · up to This change enables Angular-rendered cards to persist state through the existing chat flow. If card IDs are duplicated or reused, saving one card could update the wrong matching card; the PR is otherwise mergeable with explicit owner awareness of ID uniqueness. Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
…derer Address review feedback by moving bound continueChat/saveState actions out of the h() props object for clearer render structure. Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
saveState/continueChat无法持久化卡片 state 的问题message-renderer-angular桥接层为 action 注入 Vue 侧的cardIdSymbol@opentiny/genui-sdk-vue导出cardIdSymbol,保证与GenuiChat使用同一 Symbol 引用Bug 原因
演练场 Angular 卡片复用了 Vue Chat 创建的
saveStateAction,但卡片 ID 的传递依赖 context 上的 Symbol 键:cardIdSymbol = Symbol('schema-card-id')(useChat.ts)CARD_ID = Symbol('schema-card-id')(genui-renderer.ts)二者描述字符串相同,但
Symbol('x') === Symbol('x')恒为false。Angular 渲染器用自己的 Symbol 写入 context,Vue 的saveState用自己的 Symbol 读取,得到undefined,getCardMessage找不到消息,导致saveState静默失败。一般情况下业务不会同时混用 Angular 渲染器与 Vue Chat,因此未在 SDK 层统一 Symbol(如
Symbol.for),仅在演练场这一跨框架桥接场景做兼容。解决方案
在
sites/playground/web/src/ng-renderer/message-renderer-angular.ts中包装saveState/continueChat:执行前将[cardIdSymbol]: schemaCardProps.id写入 context,使 Vue Chat 能正确定位消息并持久化 state。同时从 vue 包导出cardIdSymbol,避免引用到不同模块实例。Summary by CodeRabbit
Bug Fixes
Improvements