Optimize persistence

This commit is contained in:
Hillel Coren 2021-08-25 10:16:33 +03:00
parent e3226ae2e8
commit 047ee4abe6
2 changed files with 4 additions and 4 deletions

View File

@ -383,7 +383,7 @@ Middleware<AppState> _createUserLoggedIn(
uiRepository.saveUIState(state.uiState);
staticRepository.saveStaticState(state.staticState);
if (state.prefState.persistData) {
if (state.prefState.persistData || state.company.isSmall) {
for (var i = 0; i < state.userCompanyStates.length; i++) {
companyRepositories[i].saveCompanyState(state.userCompanyStates[i]);
}
@ -403,7 +403,7 @@ Middleware<AppState> _createPersistData(
final index = state.uiState.selectedCompanyIndex;
final companyState = state.userCompanyStates[index];
if (state.prefState.persistData) {
if (state.prefState.persistData || state.company.isSmall) {
companyRepositories[index].saveCompanyState(companyState);
}
};

View File

@ -27,7 +27,7 @@ abstract class PrefState implements Built<PrefState, PrefStateBuilder> {
showFilterSidebar: false,
longPressSelectionIsDefault: true,
showKanban: false,
persistData: true,
persistData: !kIsWeb,
companyPrefs: BuiltMap<String, CompanyPrefState>(),
sortFields: BuiltMap<EntityType, PrefStateSortField>(),
customColors: BuiltMap<String, String>(),
@ -166,7 +166,7 @@ abstract class PrefState implements Built<PrefState, PrefStateBuilder> {
: BuiltMap<String, String>(PrefState.CONTRAST_COLORS))
..showKanban = false
..isPreviewEnabled = true
..persistData = true
..persistData = !kIsWeb
..colorTheme =
builder.enableDarkMode == true ? kColorThemeLight : kColorThemeLight;