fix(kline): stop loading when no unique new history data

When deduplicated new klines are empty, mark hasMoreHistory as false
to prevent infinite loading attempts.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-19 22:31:38 -08:00
parent 13f1b687ee
commit 84d920f98f
1 changed files with 7 additions and 0 deletions

View File

@ -154,10 +154,17 @@ class KlinesNotifier extends StateNotifier<KlinesState> {
(k) => !existingTimes.contains(k.time.millisecondsSinceEpoch) (k) => !existingTimes.contains(k.time.millisecondsSinceEpoch)
).toList(); ).toList();
//
if (uniqueNewKlines.isEmpty) {
state = state.copyWith(isLoadingMore: false, hasMoreHistory: false);
return;
}
final combinedKlines = [...uniqueNewKlines, ...state.klines]; final combinedKlines = [...uniqueNewKlines, ...state.klines];
// //
combinedKlines.sort((a, b) => a.time.compareTo(b.time)); combinedKlines.sort((a, b) => a.time.compareTo(b.time));
// 100
state = state.copyWith( state = state.copyWith(
klines: combinedKlines, klines: combinedKlines,
isLoadingMore: false, isLoadingMore: false,