From 986f4104088f961cc31c652bf4f4c2ffcd704c32 Mon Sep 17 00:00:00 2001 From: VH Date: Tue, 6 Jun 2023 14:45:53 +0700 Subject: [PATCH 1/2] Fix user's name/picture is not dynamically updated if the emoji popup --- .../home/report/ReactionList/PopoverReactionList.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/pages/home/report/ReactionList/PopoverReactionList.js b/src/pages/home/report/ReactionList/PopoverReactionList.js index ba36c1ce09ff..216349d90b62 100644 --- a/src/pages/home/report/ReactionList/PopoverReactionList.js +++ b/src/pages/home/report/ReactionList/PopoverReactionList.js @@ -68,8 +68,8 @@ class PopoverReactionList extends React.Component { } shouldComponentUpdate(nextProps, nextState) { - const prevSelectedReaction = this.getSelectedReaction(this.props.reportActions, this.state.reportActionID, this.state.emojiName); const selectedReaction = this.getSelectedReaction(nextProps.reportActions, nextState.reportActionID, nextState.emojiName); + const {emojiCount, emojiCodes, hasUserReacted, users} = this.getReactionInformation(selectedReaction); const previousLocale = lodashGet(this.props, 'preferredLocale', 'en'); const nextLocale = lodashGet(nextProps, 'preferredLocale', 'en'); @@ -78,13 +78,12 @@ class PopoverReactionList extends React.Component { this.state.popoverAnchorPosition !== nextState.popoverAnchorPosition || previousLocale !== nextLocale || (this.state.isPopoverVisible && - (!_.isEqual(prevSelectedReaction, selectedReaction) || + (this.state.reportActionID !== nextState.reportActionID || this.state.emojiName !== nextState.emojiName || - this.state.emojiCount !== nextState.emojiCount || - this.state.hasUserReacted !== nextState.hasUserReacted || - this.state.reportActionID !== nextState.reportActionID || - !_.isEqual(this.state.emojiCodes, nextState.emojiCodes) || - !_.isEqual(this.state.users, nextState.users))) + this.state.emojiCount !== emojiCount || + this.state.hasUserReacted !== hasUserReacted || + !_.isEqual(this.state.emojiCodes, emojiCodes) || + !_.isEqual(this.state.users, users))) ); } From 11d838df1d12181ea6d7c2dcbd03bd54b1a151b4 Mon Sep 17 00:00:00 2001 From: VH Date: Tue, 6 Jun 2023 14:47:52 +0700 Subject: [PATCH 2/2] Use constants instead of hard coded text --- src/pages/home/report/ReactionList/PopoverReactionList.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/home/report/ReactionList/PopoverReactionList.js b/src/pages/home/report/ReactionList/PopoverReactionList.js index 216349d90b62..bd790af8cf5e 100644 --- a/src/pages/home/report/ReactionList/PopoverReactionList.js +++ b/src/pages/home/report/ReactionList/PopoverReactionList.js @@ -15,6 +15,7 @@ import withCurrentUserPersonalDetails from '../../../../components/withCurrentUs import * as PersonalDetailsUtils from '../../../../libs/PersonalDetailsUtils'; import emojis from '../../../../../assets/emojis'; import * as EmojiUtils from '../../../../libs/EmojiUtils'; +import CONST from '../../../../CONST'; const propTypes = { /** Actions from the ChatReport */ @@ -70,8 +71,8 @@ class PopoverReactionList extends React.Component { shouldComponentUpdate(nextProps, nextState) { const selectedReaction = this.getSelectedReaction(nextProps.reportActions, nextState.reportActionID, nextState.emojiName); const {emojiCount, emojiCodes, hasUserReacted, users} = this.getReactionInformation(selectedReaction); - const previousLocale = lodashGet(this.props, 'preferredLocale', 'en'); - const nextLocale = lodashGet(nextProps, 'preferredLocale', 'en'); + const previousLocale = lodashGet(this.props, 'preferredLocale', CONST.LOCALES.DEFAULT); + const nextLocale = lodashGet(nextProps, 'preferredLocale', CONST.LOCALES.DEFAULT); return ( this.state.isPopoverVisible !== nextState.isPopoverVisible ||