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:
parent
13f1b687ee
commit
84d920f98f
|
|
@ -154,10 +154,17 @@ class KlinesNotifier extends StateNotifier<KlinesState> {
|
|||
(k) => !existingTimes.contains(k.time.millisecondsSinceEpoch)
|
||||
).toList();
|
||||
|
||||
// 如果去重后没有新数据,说明已经没有更多历史了
|
||||
if (uniqueNewKlines.isEmpty) {
|
||||
state = state.copyWith(isLoadingMore: false, hasMoreHistory: false);
|
||||
return;
|
||||
}
|
||||
|
||||
final combinedKlines = [...uniqueNewKlines, ...state.klines];
|
||||
// 按时间排序
|
||||
combinedKlines.sort((a, b) => a.time.compareTo(b.time));
|
||||
|
||||
// 判断是否还有更多历史:返回数据少于100条说明到底了
|
||||
state = state.copyWith(
|
||||
klines: combinedKlines,
|
||||
isLoadingMore: false,
|
||||
|
|
|
|||
Loading…
Reference in New Issue