Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Migrate manage snaps providers #1737

Merged
merged 20 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/app_center/lib/manage/local_snap_providers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ final showLocalSystemAppsProvider = StateProvider<bool>((_) => false);
final localSnapSortOrderProvider =
StateProvider<SnapSortOrder>((_) => SnapSortOrder.alphabeticalAsc);

// TODO: Maybe rename since it is filtered?
@riverpod
class LocalSnaps extends _$LocalSnaps {
class FilteredLocalSnaps extends _$FilteredLocalSnaps {
@override
Future<Iterable<Snap>> build() async {
final nonRefreshableSnaps = await ref.watch(
Expand Down
22 changes: 12 additions & 10 deletions packages/app_center/lib/manage/local_snap_providers.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/app_center/lib/manage/manage_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class _ManageView extends ConsumerWidget {
),
Consumer(
builder: (context, ref, _) {
final filteredLocalSnaps = ref.watch(localSnapsProvider);
final filteredLocalSnaps = ref.watch(filteredLocalSnapsProvider);
return filteredLocalSnaps.when(
data: (data) => SliverList.builder(
itemCount: data.length,
Expand Down
3 changes: 2 additions & 1 deletion packages/app_center/lib/snapd/snap_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class SnapPage extends ConsumerWidget {
if (snapDataNotFound) {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (Navigator.canPop(context)) {
ref.invalidate(localSnapsProvider);
print('we invalidate');
d-loose marked this conversation as resolved.
Show resolved Hide resolved
ref.invalidate(filteredLocalSnapsProvider);
Navigator.pop(context);
}
});
Expand Down
Loading