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 focus loss after message deletion in edit mode #49538

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
const onPopoverHide = useRef(() => {});
const onEmojiPickerToggle = useRef<undefined | ((state: boolean) => void)>();
const onCancelDeleteModal = useRef(() => {});
const onComfirmDeleteModal = useRef(() => {});
const onConfirmDeleteModal = useRef(() => {});

const onPopoverHideActionCallback = useRef(() => {});
const callbackWhenDeleteModalHide = useRef(() => {});
Expand Down Expand Up @@ -225,7 +225,7 @@

/** After Popover shows, call the registered onPopoverShow callback and reset it */
const runAndResetOnPopoverShow = () => {
setInstanceID(Math.random().toString(36).substr(2, 5));

Check failure on line 228 in src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'substr' is deprecated. A legacy feature for browser compatibility
onPopoverShow.current();

// After we have called the action, reset it.
Expand Down Expand Up @@ -264,7 +264,7 @@
};

const confirmDeleteAndHideModal = useCallback(() => {
callbackWhenDeleteModalHide.current = () => (onComfirmDeleteModal.current = runAndResetCallback(onComfirmDeleteModal.current));
callbackWhenDeleteModalHide.current = runAndResetCallback(onConfirmDeleteModal.current);
const reportAction = reportActionRef.current;
if (ReportActionsUtils.isMoneyRequestAction(reportAction)) {
const originalMessage = ReportActionsUtils.getOriginalMessage(reportAction);
Expand Down Expand Up @@ -294,8 +294,8 @@
/** Opens the Confirm delete action modal */
const showDeleteModal: ReportActionContextMenu['showDeleteModal'] = (reportID, reportAction, shouldSetModalVisibility = true, onConfirm = () => {}, onCancel = () => {}) => {
onCancelDeleteModal.current = onCancel;
onComfirmDeleteModal.current = onConfirm;

onConfirmDeleteModal.current = onConfirm;
reportIDRef.current = reportID;
reportActionRef.current = reportAction ?? null;

Expand Down
Loading