From c408128dbc9fd77f410e0f73ff4c157c59635d6d Mon Sep 17 00:00:00 2001 From: Ahmad Alkhawaja Date: Wed, 1 Sep 2021 17:45:44 +0400 Subject: [PATCH 1/2] Fixed adding copilot bug in new milestone management --- .../components/AddCopilotsSidebar/AddCopilotsSidebar.jsx | 4 ++-- .../MilestonesApprovalNotification.jsx | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/projects/detail/components/SimplePlan/components/AddCopilotsSidebar/AddCopilotsSidebar.jsx b/src/projects/detail/components/SimplePlan/components/AddCopilotsSidebar/AddCopilotsSidebar.jsx index 1b12cf1f7..733933f3f 100644 --- a/src/projects/detail/components/SimplePlan/components/AddCopilotsSidebar/AddCopilotsSidebar.jsx +++ b/src/projects/detail/components/SimplePlan/components/AddCopilotsSidebar/AddCopilotsSidebar.jsx @@ -31,11 +31,11 @@ class AddCopilotsSidebar extends React.Component { } componentDidMount() { - document.addEventListener('click', this.onClickOutside) + document.addEventListener('mousedown', this.onClickOutside) } componentWillUnmount() { - document.removeEventListener('click', this.onClickOutside) + document.removeEventListener('mousedown', this.onClickOutside) } render() { diff --git a/src/projects/detail/components/SimplePlan/components/MilestonesApprovalNotification/MilestonesApprovalNotification.jsx b/src/projects/detail/components/SimplePlan/components/MilestonesApprovalNotification/MilestonesApprovalNotification.jsx index 8582868ea..95c332927 100644 --- a/src/projects/detail/components/SimplePlan/components/MilestonesApprovalNotification/MilestonesApprovalNotification.jsx +++ b/src/projects/detail/components/SimplePlan/components/MilestonesApprovalNotification/MilestonesApprovalNotification.jsx @@ -28,6 +28,8 @@ class MilestonesApprovalNotification extends React.Component { } findLatest(approvals) { + if(!approvals) return {}; + let d = null let maxIndex = 0 for(let index = 0; index < approvals.length; index ++) { From a7df2c8bb3c8e0a9e4189ff444137f74fbe9c0d4 Mon Sep 17 00:00:00 2001 From: Ahmad Alkhawaja Date: Wed, 1 Sep 2021 17:48:25 +0400 Subject: [PATCH 2/2] lint fix --- .../MilestonesApprovalNotification.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/projects/detail/components/SimplePlan/components/MilestonesApprovalNotification/MilestonesApprovalNotification.jsx b/src/projects/detail/components/SimplePlan/components/MilestonesApprovalNotification/MilestonesApprovalNotification.jsx index 95c332927..f0873ded3 100644 --- a/src/projects/detail/components/SimplePlan/components/MilestonesApprovalNotification/MilestonesApprovalNotification.jsx +++ b/src/projects/detail/components/SimplePlan/components/MilestonesApprovalNotification/MilestonesApprovalNotification.jsx @@ -28,7 +28,7 @@ class MilestonesApprovalNotification extends React.Component { } findLatest(approvals) { - if(!approvals) return {}; + if(!approvals) return {} let d = null let maxIndex = 0