Skip to content

Commit

Permalink
Merge pull request #47486 from bernhardoj/fix/45524-message-highlight…
Browse files Browse the repository at this point in the history
…-is-stukck

Fix message highlight stuck when open the 2nd context menu
  • Loading branch information
roryabraham authored Aug 18, 2024
2 parents 67ad466 + eb6df22 commit a34f61d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ function PopoverReportActionContextMenu(_props: unknown, ref: ForwardedRef<Repor
reportIDRef.current = '-1';
reportActionIDRef.current = '-1';
originalReportIDRef.current = '-1';
setInstanceID('');

onPopoverHide.current = runAndResetCallback(onPopoverHide.current);
onPopoverHideActionCallback.current = runAndResetCallback(onPopoverHideActionCallback.current);
Expand Down
48 changes: 26 additions & 22 deletions src/pages/home/report/ContextMenu/ReportActionContextMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,33 +123,37 @@ function showContextMenu(
if (!contextMenuRef.current) {
return;
}
const show = () => {
contextMenuRef.current?.showContextMenu(
type,
event,
selection,
contextMenuAnchor,
reportID,
reportActionID,
originalReportID,
draftMessage,
onShow,
onHide,
isArchivedRoom,
isChronosReport,
isPinnedChat,
isUnreadChat,
disabledActions,
shouldCloseOnTarget,
setIsEmojiPickerActive,
isOverflowMenu,
);
};

// If there is an already open context menu, close it first before opening
// a new one.
if (contextMenuRef.current.instanceID) {
hideContextMenu();
contextMenuRef.current.runAndResetOnPopoverHide();
hideContextMenu(false, show);
return;
}

contextMenuRef.current.showContextMenu(
type,
event,
selection,
contextMenuAnchor,
reportID,
reportActionID,
originalReportID,
draftMessage,
onShow,
onHide,
isArchivedRoom,
isChronosReport,
isPinnedChat,
isUnreadChat,
disabledActions,
shouldCloseOnTarget,
setIsEmojiPickerActive,
isOverflowMenu,
);
show();
}

/**
Expand Down

0 comments on commit a34f61d

Please sign in to comment.