fix: P2P chat messages with images block rendering until download completes#526
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughTwo chat notifiers refactored to reuse static service instances for image and file uploads instead of creating new ones per call. ChatRoomNotifier additionally switches message content processing from awaited to fire-and-forget execution. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
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)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). 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 |
There was a problem hiding this comment.
LGTM. Images load properly without blocking the UI. No issues detected related to this PR.
Note: Some decrypt errors appeared in logs during testing, but I think these are unrelated to the image rendering changes.
I/flutter ( 583): �[38;5;196m┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────�[0m I/flutter ( 583): �[38;5;196m│ Exception: Failed to decrypt NIP-59 event: Exception: Decryption failed: Exception: Invalid payload size�[0m I/flutter ( 583): �[38;5;196m├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄�[0m I/flutter ( 583): �[38;5;196m│ #0 MostroService._onData (package:mostro_mobile/services/mostro_service.dart:151:14)�[0m I/flutter ( 583): �[38;5;196m│ #1 <asynchronous suspension>�[0m I/flutter ( 583): �[38;5;196m├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄�[0m I/flutter ( 583): �[38;5;196m│ 22:28:19.632 (+0:01:53.703835)�[0m I/flutter ( 583): �[38;5;196m├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄�[0m I/flutter ( 583): �[38;5;196m│ ⛔ Error processing event�[0m I/flutter ( 583): �[38;5;196m└──────────────
There was a problem hiding this comment.
Strict review completed.
I inspected both modified notifiers and the execution path change is correct:
- message insertion into state now happens before media prefetch in P2P chat,
- media prefetch is intentionally fire-and-forget (
unawaited) to avoid blocking UI rendering, - service reuse via notifier-level singletons reduces per-message object churn without changing behavior.
I did not find functional regressions in the changed scope.
Note: local Flutter validation is currently blocked by an existing dependency resolution issue in this branch (riverpod_generator vs flutter_test/test/matcher), which is pre-existing and unrelated to this diff.
fix #517
awaitinChatRoomNotifier._onChatEvent()that prevented P2P chat messages with encrypted imagesfrom appearing until download completed
EncryptedImageUploadServiceandEncryptedFileUploadServiceto static fields in bothChatRoomNotifierandDisputeChatNotifierfor consistency withChatFileUploadHelperpatternHow to test it
P2P chat image rendering (main fix)
Slow connection test
Regression checks
unawaited())Summary by CodeRabbit