fix(sender): use reactive refs for file dialog options - #282
Conversation
WalkthroughModified the file dialog component to use reactive references for configuration options (accept, multiple, reset) via toRef, enabling runtime property changes. Added a new "files-selected" event that emits the selected files array when users interact with the dialog. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
Pre-merge checks✅ Passed checks (3 passed)
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 |
📦 Package Previewpnpm add https://pkg.pr.new/opentiny/tiny-robot/@opentiny/tiny-robot@80e4f4f pnpm add https://pkg.pr.new/opentiny/tiny-robot/@opentiny/tiny-robot-kit@80e4f4f pnpm add https://pkg.pr.new/opentiny/tiny-robot/@opentiny/tiny-robot-svgs@80e4f4f commit: 80e4f4f |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI Agents
In @packages/components/src/sender/index.vue:
- Around line 482-486: The options passed to useFileDialog are primitives but
the code passes Refs via toRef, which is incompatible; change the initialization
to pass primitive values (e.g., use toValue or read the .value of the refs for
accept/multiple/reset) or remove toRef and supply literal values derived from
props.buttonGroup?.file (accept: props.buttonGroup?.file?.accept ?? '*',
multiple: Boolean(...), reset: ...), and if props can change at runtime add a
watcher that calls the useFileDialog open() with updated options when
props.buttonGroup.file changes; locate the call to useFileDialog and replace the
toRef usages accordingly.
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/components/src/sender/index.vue
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build / build
🔇 Additional comments (2)
packages/components/src/sender/index.vue (2)
2-2: LGTM! Import addition is appropriate.The
toRefimport is correctly added to support reactive file dialog options below.
488-492: LGTM! Event emission logic is correct.The watcher appropriately emits the new
files-selectedevent when files are selected. The use ofArray.from()ensures proper array conversion from theFileListobject.
🧹 Preview Cleaned UpThe preview deployment has been removed. |

修复 Sender 组件解构上传对象参数丢失响应式
关联 issue -> #281
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.