Skip to content

fix(core): fix StreamDraftListController.deleteDraft removing the wrong draft - #3054

Merged
VelikovPetar merged 3 commits into
masterfrom
fix/flu-956_draft_list_delete_wrong_draft
Oct 9, 2026
Merged

VelikovPetar merged 3 commits into
masterfrom
fix/flu-956_draft_list_delete_wrong_draft

Conversation

@VelikovPetar

@VelikovPetar VelikovPetar commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Submit a pull request

Linear: FLU-956

Github Issue: -

CLA

  • I have signed the Stream CLA (required).
  • The code changes follow best practices
  • Code changes are tested (add some information if not applicable)

Description of the pull request

Deleting a channel draft made StreamDraftListController drop a thread draft of the same channel from the list, while the channel draft stayed. The server deleted the right draft; only the list was wrong.

What changes

  • deleteDraft matches on channelCid and parentId, so a channel draft (no parentId) only matches another channel draft. Before, a missing parentId matched any draft of the channel, and the first one in the list was removed.
  • updateDraft uses the same (channelCid, parentId) key instead of a concatenated string.

Testing

  • New regression test in stream_draft_list_controller_test.dart: a thread draft followed by a channel draft of the same channel; deleting the channel draft leaves only the thread draft. Fails on master, passes here.
  • Sample app (web, Drafts tab with "Draft Messages" enabled): with a thread draft and a channel draft in one channel, swipe-delete the channel draft. Only the channel draft should disappear.

Screenshots / Videos

Before / After
flu-956_draft_delete_before_after.mp4

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Fixed draft updates and deletions to match drafts by both channel and thread, preventing a channel draft from removing or updating the wrong draft.
    • Added a regression test covering deletion when a thread draft appears before a channel draft.

… the draft list

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3ab42fbf-e9aa-4c3e-9e88-1333937b6af6

📥 Commits

Reviewing files that changed from the base of the PR and between 437f6fb and edb7e60.


📒 Files selected for processing (3)
  • packages/stream_chat_flutter_core/CHANGELOG.md
  • packages/stream_chat_flutter_core/lib/src/stream_draft_list_controller.dart
  • packages/stream_chat_flutter_core/test/stream_draft_list_controller_test.dart

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.



📝 Walkthrough

Walkthrough

StreamDraftListController now uses the (channelCid, parentId) pair to identify drafts during updates and deletions. A regression test checks deletion when a channel draft and a thread draft share a channel ID.

Changes

Draft matching

Layer / File(s) Summary
Draft identity and deletion matching
packages/stream_chat_flutter_core/lib/src/stream_draft_list_controller.dart, packages/stream_chat_flutter_core/test/stream_draft_list_controller_test.dart, packages/stream_chat_flutter_core/CHANGELOG.md
A shared key identifies drafts by channelCid and parentId during updates and deletions. A regression test checks that deleting a channel draft leaves the thread draft intact. The changelog records the fix.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: xsahil03x

Fixed issue severity: <fixed_issue_severity>Low</fixed_issue_severity>


Merge Risk: ⚪ Minimal · up to edb7e

The change is intended to keep channel and thread drafts distinct during deletion, and the added test targets that case. No concrete remaining risk is evident; merge after normal checks.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the main change: fixing StreamDraftListController.deleteDraft removing the wrong draft. It is specific and directly related to the pull request.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.


✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@VelikovPetar VelikovPetar changed the title fix(core): remove the deleted channel draft, not a thread draft, from the draft list fix(core): fix StreamDraftListController.deleteDraft removing the wrong draft Oct 9, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@VelikovPetar
VelikovPetar marked this pull request as ready for review October 9, 2026 10:46
@VelikovPetar
VelikovPetar requested a review from a team October 9, 2026 10:46
@codecov

codecov Bot commented Oct 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.02%. Comparing base (437f6fb) to head (edb7e60).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3054      +/-   ##
==========================================
- Coverage   78.02%   78.02%   -0.01%     
==========================================
  Files         450      450              
  Lines       29320    29314       -6     
==========================================
- Hits        22877    22872       -5     
+ Misses       6443     6442       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@VelikovPetar
VelikovPetar merged commit 7dd9b06 into master Oct 9, 2026
36 checks passed
@VelikovPetar
VelikovPetar deleted the fix/flu-956_draft_list_delete_wrong_draft branch October 9, 2026 12:22
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.

2 participants