mirror of
https://github.com/zapstore/zapstore.git
synced 2026-10-05 12:38:24 +00:00
Data loading adjustments
This commit is contained in:
@@ -124,8 +124,9 @@ mixin NostrAdapter<T extends DataModelMixin<T>> on Adapter<T> {
|
||||
kinds: {kind, ...?additionalKinds},
|
||||
tags: params,
|
||||
limit: limit,
|
||||
since: since,
|
||||
until: until,
|
||||
// Disable since when until is present
|
||||
since: until != null ? null : since,
|
||||
);
|
||||
|
||||
final result = await relay.queryRaw(req);
|
||||
@@ -170,7 +171,6 @@ mixin NostrAdapter<T extends DataModelMixin<T>> on Adapter<T> {
|
||||
class RelayListenerNotifier extends Notifier<void> {
|
||||
@override
|
||||
void build() {
|
||||
fetch();
|
||||
final timer = Timer.periodic(Duration(minutes: 30), (_) => fetch());
|
||||
|
||||
// This will get disposed when clearing and restarting the app
|
||||
|
||||
@@ -88,17 +88,13 @@ class LatestReleasesAppNotifier extends StateNotifier<AsyncValue<List<App>>> {
|
||||
int _page = 1;
|
||||
final Ref ref;
|
||||
|
||||
LatestReleasesAppNotifier(this.ref) : super(AsyncLoading());
|
||||
LatestReleasesAppNotifier(this.ref) : super(AsyncLoading()) {
|
||||
fetch();
|
||||
}
|
||||
|
||||
Future<void> fetch({bool next = false}) async {
|
||||
if (next) {
|
||||
_page++;
|
||||
} else {
|
||||
final apps = _fetchLocal();
|
||||
if (apps.isNotEmpty) {
|
||||
state = AsyncData(apps);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Can't use ignoreReturn, as super.findAll does use the result
|
||||
@@ -107,6 +103,7 @@ class LatestReleasesAppNotifier extends StateNotifier<AsyncValue<List<App>>> {
|
||||
'includes': true,
|
||||
'limit': 10,
|
||||
'until': next ? _oldestCreatedAt : null,
|
||||
'since': null,
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user