Skip to content

Commit a34f61d

Browse files
authored
Merge pull request #47486 from bernhardoj/fix/45524-message-highlight-is-stukck
Fix message highlight stuck when open the 2nd context menu
2 parents 67ad466 + eb6df22 commit a34f61d

File tree

2 files changed

+27
-22
lines changed

2 files changed

+27
-22
lines changed

src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ function PopoverReportActionContextMenu(_props: unknown, ref: ForwardedRef<Repor
242242
reportIDRef.current = '-1';
243243
reportActionIDRef.current = '-1';
244244
originalReportIDRef.current = '-1';
245+
setInstanceID('');
245246

246247
onPopoverHide.current = runAndResetCallback(onPopoverHide.current);
247248
onPopoverHideActionCallback.current = runAndResetCallback(onPopoverHideActionCallback.current);

src/pages/home/report/ContextMenu/ReportActionContextMenu.ts

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -123,33 +123,37 @@ function showContextMenu(
123123
if (!contextMenuRef.current) {
124124
return;
125125
}
126+
const show = () => {
127+
contextMenuRef.current?.showContextMenu(
128+
type,
129+
event,
130+
selection,
131+
contextMenuAnchor,
132+
reportID,
133+
reportActionID,
134+
originalReportID,
135+
draftMessage,
136+
onShow,
137+
onHide,
138+
isArchivedRoom,
139+
isChronosReport,
140+
isPinnedChat,
141+
isUnreadChat,
142+
disabledActions,
143+
shouldCloseOnTarget,
144+
setIsEmojiPickerActive,
145+
isOverflowMenu,
146+
);
147+
};
148+
126149
// If there is an already open context menu, close it first before opening
127150
// a new one.
128151
if (contextMenuRef.current.instanceID) {
129-
hideContextMenu();
130-
contextMenuRef.current.runAndResetOnPopoverHide();
152+
hideContextMenu(false, show);
153+
return;
131154
}
132155

133-
contextMenuRef.current.showContextMenu(
134-
type,
135-
event,
136-
selection,
137-
contextMenuAnchor,
138-
reportID,
139-
reportActionID,
140-
originalReportID,
141-
draftMessage,
142-
onShow,
143-
onHide,
144-
isArchivedRoom,
145-
isChronosReport,
146-
isPinnedChat,
147-
isUnreadChat,
148-
disabledActions,
149-
shouldCloseOnTarget,
150-
setIsEmojiPickerActive,
151-
isOverflowMenu,
152-
);
156+
show();
153157
}
154158

155159
/**

0 commit comments

Comments
 (0)