Skip to content

Commit

Permalink
fix: Allow update of recipe list view while refreshing
Browse files Browse the repository at this point in the history
  • Loading branch information
TomBursch committed Nov 30, 2023
1 parent d2e4384 commit 2a540ff
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/cubits/recipe_list_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ class RecipeListCubit extends Cubit<RecipeListState> {
ListRecipeListState(
recipes: _state.allRecipes,
tags: _state.tags,
listView: _state.listView,
listView: state.listView,
),
);
} else {
emit(_state.copyWith(
listView: state.listView,
selectedTags: selectedTags,
recipes: _getFilteredRecipesCopy(
_state.allRecipes,
Expand Down Expand Up @@ -83,13 +84,11 @@ class RecipeListCubit extends Cubit<RecipeListState> {
}

Future<void> _refresh([String? query, bool runOffline = false]) async {
final state = this.state;

late ListRecipeListState _state;
if (state is ListRecipeListState &&
state is! SearchRecipeListState &&
state is! FilteredListRecipeListState &&
state.recipes.isEmpty) {
(state as ListRecipeListState).recipes.isEmpty) {
emit(LoadingRecipeListState(listView: state.listView));
}

Expand Down Expand Up @@ -120,7 +119,7 @@ class RecipeListCubit extends Cubit<RecipeListState> {
);
Set<Tag> filter = const {};
if (state is FilteredListRecipeListState && (query == null)) {
filter = state.selectedTags;
filter = (state as FilteredListRecipeListState).selectedTags;
}
_state = filter.isNotEmpty
? FilteredListRecipeListState(
Expand Down

0 comments on commit 2a540ff

Please sign in to comment.