From 6eb7ff8be22de2b2adfb9cba4a4a4c5dee4b9d3e Mon Sep 17 00:00:00 2001 From: Jonathan Bursztyn Date: Thu, 25 Jul 2024 23:59:27 +0100 Subject: [PATCH] Checks on method calls before use --- app/components/UI/OptinMetrics/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/components/UI/OptinMetrics/index.js b/app/components/UI/OptinMetrics/index.js index 004690410e3..ba2ec7added 100644 --- a/app/components/UI/OptinMetrics/index.js +++ b/app/components/UI/OptinMetrics/index.js @@ -305,7 +305,10 @@ class OptinMetrics extends PureComponent { } = this.props; setTimeout(async () => { const { clearOnboardingEvents, metrics } = this.props; - if (isDataCollectionForMarketingEnabled === null) { + if ( + isDataCollectionForMarketingEnabled === null && + setDataCollectionForMarketing + ) { setDataCollectionForMarketing(false); } // if users refuses tracking, get rid of the stored events @@ -331,7 +334,10 @@ class OptinMetrics extends PureComponent { InteractionManager.runAfterInteractions(async () => { // add traits to user for identification - if (isDataCollectionForMarketingEnabled === null) { + if ( + isDataCollectionForMarketingEnabled === null && + setDataCollectionForMarketing + ) { setDataCollectionForMarketing(false); }