From da6809f96cb218b6fa8c170691c40b0f2c9ca4ad Mon Sep 17 00:00:00 2001 From: Dennis Snell Date: Tue, 1 Sep 2020 10:58:00 -0500 Subject: [PATCH] Relax preferences updates --- lib/state/simperium/middleware.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/state/simperium/middleware.ts b/lib/state/simperium/middleware.ts index 2172d5831..940a983b8 100644 --- a/lib/state/simperium/middleware.ts +++ b/lib/state/simperium/middleware.ts @@ -348,13 +348,20 @@ export const initSimperium = ( case 'SET_ANALYTICS': preferencesBucket.get('preferences-key').then((preferences) => { + if ( + preferences.data && + !!preferences.data.analytics_enabled === action.allowAnalytics + ) { + return; + } + preferencesBucket.update( 'preferences-key', { ...preferences.data, analytics_enabled: action.allowAnalytics, }, - { sync: true } + { sync: false } ); }); return result;