Optimize persitence

This commit is contained in:
Hillel Coren 2021-08-22 11:39:10 +03:00
parent 5cb7f59573
commit 1edf7d0a00
2 changed files with 4 additions and 8 deletions

View File

@ -394,9 +394,9 @@ Middleware<AppState> _createPersistData(
final index = state.uiState.selectedCompanyIndex; final index = state.uiState.selectedCompanyIndex;
final companyState = state.userCompanyStates[index]; final companyState = state.userCompanyStates[index];
if (companyState.company.isSmall || !kIsWeb) { //if (companyState.company.isSmall || !kIsWeb) {
companyRepositories[index].saveCompanyState(companyState); companyRepositories[index].saveCompanyState(companyState);
} //}
}; };
} }
@ -451,9 +451,6 @@ Middleware<AppState> _createAccountLoaded() {
store.dispatch( store.dispatch(
SelectCompany(companyIndex: i, clearSelection: loadedStaticData)); SelectCompany(companyIndex: i, clearSelection: loadedStaticData));
store.dispatch(LoadCompanySuccess(userCompany)); store.dispatch(LoadCompanySuccess(userCompany));
if (!userCompany.company.isLarge) {
store.dispatch(PersistData());
}
} }
} catch (error) { } catch (error) {
action.completer?.completeError(error); action.completer?.completeError(error);
@ -516,7 +513,7 @@ Middleware<AppState> _createDataRefreshed() {
rethrow; rethrow;
} }
store.dispatch(UserLoginSuccess()); store.dispatch(PersistData());
if (action.completer != null) { if (action.completer != null) {
action.completer.complete(null); action.completer.complete(null);

View File

@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_redux/flutter_redux.dart'; import 'package:flutter_redux/flutter_redux.dart';
import 'package:invoiceninja_flutter/redux/app/app_state.dart'; import 'package:invoiceninja_flutter/redux/app/app_state.dart';
import 'package:invoiceninja_flutter/redux/auth/auth_actions.dart'; import 'package:invoiceninja_flutter/redux/auth/auth_actions.dart';
import 'package:invoiceninja_flutter/utils/platforms.dart';
// ignore: unused_import // ignore: unused_import
import 'package:invoiceninja_flutter/utils/web_stub.dart' import 'package:invoiceninja_flutter/utils/web_stub.dart'