From b9bb4e6602ef0d5701335c157590efbf88fe07cf Mon Sep 17 00:00:00 2001 From: Pujan Date: Tue, 22 Nov 2022 11:43:04 +0530 Subject: [PATCH 1/2] reset the state for the delay context action if it is not the delete action --- .../PopoverReportActionContextMenu.js | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js index 2ac4cf1042b02..f75e570ddbd32 100644 --- a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js +++ b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js @@ -212,14 +212,24 @@ class PopoverReportActionContextMenu extends React.Component { hideContextMenu(onHideActionCallback) { if (_.isFunction(onHideActionCallback)) { this.onPopoverHideActionCallback = onHideActionCallback; + if (!this.state.isDeleteCommentConfirmModalVisible) { + this.setState({ + reportID: '0', + reportAction: {}, + selection: '', + reportActionDraftMessage: '', + isPopoverVisible: false, + }); + } + } else { + this.setState({ + reportID: '0', + reportAction: {}, + selection: '', + reportActionDraftMessage: '', + isPopoverVisible: false, + }); } - this.setState({ - reportID: '0', - reportAction: {}, - selection: '', - reportActionDraftMessage: '', - isPopoverVisible: false, - }); } /** From d3cd179e7b975b1a8094c4ac1e0e2f09d2419855 Mon Sep 17 00:00:00 2001 From: Pujan Date: Wed, 30 Nov 2022 11:05:42 +0530 Subject: [PATCH 2/2] fix for reset report fields --- .../PopoverReportActionContextMenu.js | 28 ++++++------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js index f75e570ddbd32..da1c83348f5e5 100644 --- a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js +++ b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js @@ -201,8 +201,10 @@ class PopoverReportActionContextMenu extends React.Component { * After Popover hides, call the registered onPopoverHide & onPopoverHideActionCallback callback and reset it */ runAndResetOnPopoverHide() { - this.onPopoverHide = this.runAndResetCallback(this.onPopoverHide); - this.onPopoverHideActionCallback = this.runAndResetCallback(this.onPopoverHideActionCallback); + this.setState({reportID: '0', reportAction: {}}, () => { + this.onPopoverHide = this.runAndResetCallback(this.onPopoverHide); + this.onPopoverHideActionCallback = this.runAndResetCallback(this.onPopoverHideActionCallback); + }); } /** @@ -212,24 +214,12 @@ class PopoverReportActionContextMenu extends React.Component { hideContextMenu(onHideActionCallback) { if (_.isFunction(onHideActionCallback)) { this.onPopoverHideActionCallback = onHideActionCallback; - if (!this.state.isDeleteCommentConfirmModalVisible) { - this.setState({ - reportID: '0', - reportAction: {}, - selection: '', - reportActionDraftMessage: '', - isPopoverVisible: false, - }); - } - } else { - this.setState({ - reportID: '0', - reportAction: {}, - selection: '', - reportActionDraftMessage: '', - isPopoverVisible: false, - }); } + this.setState({ + selection: '', + reportActionDraftMessage: '', + isPopoverVisible: false, + }); } /**