-
Notifications
You must be signed in to change notification settings - Fork 364
fix(core): handle channel reload failure on dispose #2311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The channel reload on `MessageListCore.dispose` could potentially fail for various reasons, such as the user having already left the channel or the channel being deleted. This change wraps the reload call in a try-catch block to gracefully handle these scenarios, preventing the application from crashing.
""" WalkthroughThe updates adjust channel reloading logic across core message list and channel state management. Channel reloads on disposal are now centralized with improved error handling, and a fallback ensures outdated channels are refreshed to the latest messages. Conditional checks for parent message updates are also corrected for accuracy. Changes
Sequence Diagram(s)sequenceDiagram
participant UI
participant MessageListCoreState
participant StreamChannel
UI->>MessageListCoreState: dispose()
MessageListCoreState->>MessageListCoreState: _reloadChannelIfNeeded()
alt Channel not up to date
MessageListCoreState->>StreamChannel: reloadChannel()
StreamChannel-->>MessageListCoreState: (completes, errors ignored)
else Channel up to date
MessageListCoreState-->>MessageListCoreState: No action
end
sequenceDiagram
participant StreamChannelState
participant ChannelState
StreamChannelState->>ChannelState: _maybeInitChannel()
alt Initial message ID exists
ChannelState->>ChannelState: loadChannelAtMessage(initialMessageId)
else Last read message/timestamp exists
ChannelState->>ChannelState: loadChannelAtMessage(lastReadMessageId/timestamp)
else Channel not up to date
ChannelState->>ChannelState: loadChannelAtMessage(null)
end
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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). (10)
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2311 +/- ##
==========================================
- Coverage 63.56% 63.55% -0.01%
==========================================
Files 409 409
Lines 25571 25572 +1
==========================================
Hits 16253 16253
- Misses 9318 9319 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Submit a pull request
Fixes: #2294
Description of the pull request
The channel reload on
MessageListCore.dispose
could potentially fail for various reasons, such as the user having already left the channel or the channel being deleted. This change wraps the reload call in a try-catch block to gracefully handle these scenarios, preventing the application from crashing.Additionally, now
StreamChannel
will initialize the channel from latest messages if there is noinitialMessageId
orunread
is available.Summary by CodeRabbit
Summary by CodeRabbit