Skip to content
This repository has been archived by the owner on Aug 24, 2024. It is now read-only.

Commit

Permalink
fix(use_listent_message): early return on Reply and None relations (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
b-avb authored Feb 28, 2024
1 parent c5b641e commit 451380b
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/hooks/use_listen_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,11 @@ pub fn use_listen_message(cx: &ScopeState) -> &UseListenMessagesState {
}
None => {
if is_in_current_room {
let Some(position) = message_position_local else {
if let Some(position) = message_position_local {
msgs[position] = message.clone()
} else {
msgs.push(message.clone());

return;
};

msgs[position] = message.clone()
}
} else {
plain_message = Some(message_to_plain_content(
&timeline_message.body,
Expand All @@ -159,13 +157,11 @@ pub fn use_listen_message(cx: &ScopeState) -> &UseListenMessagesState {
}
TimelineRelation::Reply(timeline_message) => {
if is_in_current_room {
let Some(position) = message_position_local else {
if let Some(position) = message_position_local {
msgs[position] = message.clone();
} else {
msgs.push(message.clone());

return;
};

msgs[position] = message.clone()
} else {
plain_message = Some(message_to_plain_content(
&timeline_message.event.body,
Expand Down

0 comments on commit 451380b

Please sign in to comment.