Fix crash in channel files screen caused by duplicate IDs#6132
Fix crash in channel files screen caused by duplicate IDs#6132VelikovPetar merged 2 commits intodevelopfrom
Conversation
Co-Authored-By: Claude <[email protected]>
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
SDK Size Comparison 📏
|
|
WalkthroughThe change modifies the unique identifier generation for attachment items in ChannelAttachmentsViewState, replacing the imagePreviewUrl-based identifier with attachment.hashCode(). This alters how attachment items are uniquely identified without changing the overall data structure or behavior. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 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 |



Goal
The channel files screen was crashing due to duplicate item IDs in the list. This happened because the ID was generated using
attachment.imagePreviewUrl, which can be null for file attachments, causing a message with 2 file attachments to produce the same ID for 2 items.Implementation
Changed the unique ID generation for
ChannelAttachmentsViewState.Result.Itemfrom usingattachment.imagePreviewUrltoattachment.hashCode(). This ensures each attachment gets a unique identifier regardless of whether it has an image preview URL.🎨 UI Changes
crash-before.mp4
crash-after.mp4
Testing
FilesSummary by CodeRabbit
Release Notes