Skip to content

fix(message): correct delta/message selection when both exist in stream#297

Open
gene9831 wants to merge 1 commit intoopentiny:developfrom
gene9831:fix/correct-delta-message-selection
Open

fix(message): correct delta/message selection when both exist in stream#297
gene9831 wants to merge 1 commit intoopentiny:developfrom
gene9831:fix/correct-delta-message-selection

Conversation

@gene9831
Copy link
Collaborator

@gene9831 gene9831 commented Feb 2, 2026

  • Add objectDataIsValid helper to detect non-empty objects with truthy values
  • Prefer choice.delta over choice.message when delta has valid data
  • Fallback to choice.delta || choice.message || {} when neither is valid

Summary by CodeRabbit

  • Bug Fixes
    • Improved message data handling to prevent empty object processing and better manage edge cases during message delta application.

- Add objectDataIsValid helper to detect non-empty objects with truthy values
- Prefer choice.delta over choice.message when delta has valid data
- Fallback to choice.delta || choice.message || {} when neither is valid
@coderabbitai
Copy link

coderabbitai bot commented Feb 2, 2026

Walkthrough

A TypeScript utility file in the Vue message module is updated to add an internal validation helper and refine message data selection logic. The new objectDataIsValid function checks if objects contain truthy properties, and the data selection now prioritizes choice.delta over choice.message with explicit fallback behavior, improving robustness when processing message updates.

Changes

Cohort / File(s) Summary
Message Delta Validation
packages/kit/src/vue/message/useMessage.ts
Introduces objectDataIsValid helper to validate non-empty objects. Replaces direct message-or-delta selection with explicit priority logic: prefer validated delta, fallback to message, then empty object. Strengthens guard against empty data in message delta application.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A helper bunny hops in with care,
Checking objects everywhere!
Delta's preferred, message's near,
Validation magic made crystal clear! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main fix: correcting the selection logic between delta and message fields when both exist in the stream, which aligns with the core change of adding data validation and proper fallback handling.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 2, 2026

✅ Preview build completed successfully!

Click the image above to preview.
Preview will be automatically removed when this PR is closed.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 2, 2026

@gene9831 gene9831 linked an issue Feb 2, 2026 that may be closed by this pull request
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.

【bug】kit 合并消息流部分场景存在 bug

2 participants