From 71650fd31d415a44d4e183dad610cbd438d0c5bd Mon Sep 17 00:00:00 2001 From: Chika Date: Wed, 13 Jul 2022 13:04:08 +0300 Subject: [PATCH] fix prev commit --- process/lead-opportunity/reactions/common.ts | 3 +++ process/lead-opportunity/reactions/urls.ts | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/process/lead-opportunity/reactions/common.ts b/process/lead-opportunity/reactions/common.ts index e9054d7..9d6e485 100644 --- a/process/lead-opportunity/reactions/common.ts +++ b/process/lead-opportunity/reactions/common.ts @@ -65,6 +65,9 @@ export default function commonReactions(store: RootStore, apolloClient: ApolloCl reaction( () => $calculation.getElementValue('selectOpportunity'), async (opportunityid) => { + if (!opportunityid) { + return; + } const { data } = await apolloClient.query({ query: QUERY_GET_LEADID_BY_OPPORTUNITY, variables: { diff --git a/process/lead-opportunity/reactions/urls.ts b/process/lead-opportunity/reactions/urls.ts index 790b8e9..cb98b45 100644 --- a/process/lead-opportunity/reactions/urls.ts +++ b/process/lead-opportunity/reactions/urls.ts @@ -14,6 +14,10 @@ export default function urlsReactions(store: RootStore, apolloClient: ApolloClie reaction( () => $calculation.getElementValue(elementName), (id) => { + if (!id) { + $calculation.resetElementValue(linkElementName); + } + const timeoutId = setTimeout(() => { $calculation.$status.setStatus(linkElementName, 'Loading'); }, 1200); @@ -33,7 +37,7 @@ export default function urlsReactions(store: RootStore, apolloClient: ApolloClie }) .catch(() => { clearTimeout(timeoutId); - $calculation.setElementValue(linkElementName, null); + $calculation.resetElementValue(linkElementName); }); } );