From 1edf7d0a00cb62d9de4eda86d31189290e9eb5e5 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 22 Aug 2021 11:39:10 +0300 Subject: [PATCH] Optimize persitence --- lib/redux/app/app_middleware.dart | 11 ++++------- lib/ui/app/web_session_timeout.dart | 1 - 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/redux/app/app_middleware.dart b/lib/redux/app/app_middleware.dart index 9b08838a8..629ec43d4 100644 --- a/lib/redux/app/app_middleware.dart +++ b/lib/redux/app/app_middleware.dart @@ -394,9 +394,9 @@ Middleware _createPersistData( final index = state.uiState.selectedCompanyIndex; final companyState = state.userCompanyStates[index]; - if (companyState.company.isSmall || !kIsWeb) { - companyRepositories[index].saveCompanyState(companyState); - } + //if (companyState.company.isSmall || !kIsWeb) { + companyRepositories[index].saveCompanyState(companyState); + //} }; } @@ -451,9 +451,6 @@ Middleware _createAccountLoaded() { store.dispatch( SelectCompany(companyIndex: i, clearSelection: loadedStaticData)); store.dispatch(LoadCompanySuccess(userCompany)); - if (!userCompany.company.isLarge) { - store.dispatch(PersistData()); - } } } catch (error) { action.completer?.completeError(error); @@ -516,7 +513,7 @@ Middleware _createDataRefreshed() { rethrow; } - store.dispatch(UserLoginSuccess()); + store.dispatch(PersistData()); if (action.completer != null) { action.completer.complete(null); diff --git a/lib/ui/app/web_session_timeout.dart b/lib/ui/app/web_session_timeout.dart index 954d50ebc..f887b7553 100644 --- a/lib/ui/app/web_session_timeout.dart +++ b/lib/ui/app/web_session_timeout.dart @@ -4,7 +4,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_redux/flutter_redux.dart'; import 'package:invoiceninja_flutter/redux/app/app_state.dart'; import 'package:invoiceninja_flutter/redux/auth/auth_actions.dart'; -import 'package:invoiceninja_flutter/utils/platforms.dart'; // ignore: unused_import import 'package:invoiceninja_flutter/utils/web_stub.dart'