Skip to content

Commit d4793ff

Browse files
fix: coderrabit suggestions
1 parent 8990370 commit d4793ff

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

app/containers/message/index.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,13 +274,19 @@ class MessageContainer extends React.Component<IMessageContainerProps, IMessageC
274274
return { proxyReactions: updated };
275275
});
276276

277-
// still call server
278-
277+
// update on server
279278
const success = await onReactionPress(emoji, item.id);
279+
280+
// if fails use server's state as source of truth
280281
if (!success) {
281282
Alert.alert(i18n.t('Error'), i18n.t('Reaction_Failed'));
282283
// rollback on failure
283284
this.setState({ proxyReactions: undefined });
285+
return;
286+
}
287+
288+
if (!this.subscription) {
289+
this.setState({ proxyReactions: undefined });
284290
}
285291
};
286292

0 commit comments

Comments
 (0)