feat: Fix loop uses sinceState instead of newSinceState, causing infinite loops.
This commit is contained in:
@@ -19,6 +19,8 @@ import 'package:uuid/uuid.dart';
|
||||
class LabelApi
|
||||
with HandleSetErrorMixin, SessionMixin, BatchGetLabelProcessingMixin {
|
||||
|
||||
static const int _defaultMaxChanges = 128;
|
||||
|
||||
final HttpClient _httpClient;
|
||||
final Uuid _uuid;
|
||||
|
||||
@@ -179,7 +181,7 @@ class LabelApi
|
||||
final changesLabelMethod = ChangesLabelMethod(
|
||||
accountId,
|
||||
sinceState,
|
||||
maxChanges: UnsignedInt(128),
|
||||
maxChanges: UnsignedInt(_defaultMaxChanges),
|
||||
);
|
||||
final changesLabelInvocation =
|
||||
jmapRequestBuilder.invocation(changesLabelMethod);
|
||||
|
||||
@@ -50,7 +50,7 @@ class LabelRepositoryImpl extends LabelRepository {
|
||||
final changesResponse = await _labelDatasource.getLabelChanges(
|
||||
session,
|
||||
accountId,
|
||||
sinceState,
|
||||
newSinceState,
|
||||
);
|
||||
|
||||
hasMoreChanges = changesResponse.hasMoreChanges;
|
||||
|
||||
@@ -36,8 +36,10 @@ extension HandleLabelWebsocketExtension on LabelController {
|
||||
|
||||
if (refreshState is GetLabelChangesSuccess) {
|
||||
await _handleGetLabelChangesSuccess(refreshState);
|
||||
} else {
|
||||
} else if (refreshState != null) {
|
||||
onDataFailureViewState(refreshState);
|
||||
} else {
|
||||
logWarning('HandleLabelWebsocketExtension::handleWebSocketMessage: refreshState is null');
|
||||
}
|
||||
} catch (e, stackTrace) {
|
||||
logWarning(
|
||||
|
||||
@@ -244,6 +244,10 @@ class LabelUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/// Applies label changes to [currentLabels] **in place**.
|
||||
///
|
||||
/// Removes labels matching [destroyedIds], [created], and [updated] IDs,
|
||||
/// then appends [created] and [updated] labels.
|
||||
static void applyLabelChanges({
|
||||
required List<Label> currentLabels,
|
||||
required List<Label> created,
|
||||
|
||||
Reference in New Issue
Block a user