Skip to content
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

Fix long pressing the comment reaction does not open the reactions modal the first time you do it #43464

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/hooks/useBasePopoverReactionList/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default function useBasePopoverReactionList({emojiName, emojiReactions, a
emojiCodes: [],
hasUserReacted: false,
users: [],
isReady: false,
};
}

Expand All @@ -34,6 +35,7 @@ export default function useBasePopoverReactionList({emojiName, emojiReactions, a
reactionCount,
hasUserReacted,
users,
isReady: true,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ function BasePopoverReactionList(props: BasePopoverReactionListPropsWithLocalWit
preferredLocale,
});
// Get the reaction information
const {emojiCodes, reactionCount, hasUserReacted, users} = getReactionInformation();

const {emojiCodes, reactionCount, hasUserReacted, users, isReady} = getReactionInformation();
useImperativeHandle(ref, () => ({hideReactionList, showReactionList}));

return (
<PopoverWithMeasuredContent
isVisible={isPopoverVisible}
isVisible={isPopoverVisible && isReady}
Copy link
Contributor Author

@bernhardoj bernhardoj Jun 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that it's possible the other information isn't ready yet when the popover is visible, instead of checking each information one-by-one, I returned the isReady variable from getReactionInformation.

Screen.Recording.2024-06-11.at.19.53.03.mov

onClose={hideReactionList}
anchorPosition={popoverAnchorPosition}
animationIn="fadeIn"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ function PopoverReactionList(props: unknown, ref: ForwardedRef<ReactionListRef>)

useImperativeHandle(ref, () => ({showReactionList, hideReactionList, isActiveReportAction}));

if (reactionListReportActionID === '' || reactionListEmojiName === '') {
return null;
}

return (
<BasePopoverReactionList
ref={innerReactionListRef}
Expand Down
Loading