Skip to content

Commit

Permalink
Relax preferences updates
Browse files Browse the repository at this point in the history
  • Loading branch information
dmsnell committed Sep 1, 2020
1 parent 4e641da commit da6809f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/state/simperium/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit da6809f

Please sign in to comment.