monkey-front-core 0.0.315 → 0.0.317

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2455,6 +2455,7 @@ const seederReducer = (keys) => {
2455
2455
  return (reducer) => {
2456
2456
  return (state, action) => {
2457
2457
  const handledState = reducer(state, action);
2458
+ let data = handledState;
2458
2459
  if (action.type === INIT || action.type === UPDATE) {
2459
2460
  const storageValue = localStorage.getItem('mecx-store');
2460
2461
  if (storageValue) {
@@ -2469,19 +2470,22 @@ const seederReducer = (keys) => {
2469
2470
  localStorage.removeItem('mecx-store');
2470
2471
  }
2471
2472
  }
2472
- }
2473
- let data = handledState;
2474
- try {
2475
- keys.forEach((key) => {
2476
- data = {
2477
- ...data,
2478
- [key]: handledState[key]
2479
- };
2480
- });
2481
- localStorage.setItem('mecx-store', btoa(JSON.stringify(data)));
2482
- }
2483
- catch (e) {
2484
- localStorage.removeItem('mecx-store');
2473
+ data = null;
2474
+ try {
2475
+ keys.forEach((key) => {
2476
+ data = {
2477
+ ...data,
2478
+ [key]: handledState[key]
2479
+ };
2480
+ });
2481
+ const handled = JSON.stringify(data);
2482
+ if (handled !== '{}') {
2483
+ localStorage.setItem('mecx-store', btoa(JSON.stringify(data)));
2484
+ }
2485
+ }
2486
+ catch (e) {
2487
+ localStorage.removeItem('mecx-store');
2488
+ }
2485
2489
  }
2486
2490
  return data || handledState;
2487
2491
  };