Skip to content

Commit

Permalink
fix(mobile): Fix Recently added page
Browse files Browse the repository at this point in the history
  • Loading branch information
l0nax committed Dec 28, 2023
1 parent 2972205 commit c703890
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions mobile/lib/modules/search/providers/recently_added.provider.dart
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/shared/models/asset.dart';
import 'package:immich_mobile/shared/providers/api.provider.dart';
import 'package:immich_mobile/shared/providers/db.provider.dart';
import 'package:isar/isar.dart';

final recentlyAddedProvider = FutureProvider<List<Asset>>( (ref) async {
final search = await ref.watch(apiServiceProvider).searchApi.search(
recent: true,
);

if (search == null) {
return [];
}

return ref.watch(dbProvider)
.assets
.getAllByRemoteId(
search.assets.items.map((e) => e.id),
);
.where()
.sortByFileCreatedAtDesc()
.findAll();
});

0 comments on commit c703890

Please sign in to comment.