From e375736f27b7f5be9d6302bd15195bcbb17fa43c Mon Sep 17 00:00:00 2001 From: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> Date: Wed, 9 Jul 2025 08:17:51 +0530 Subject: [PATCH] change total assets before emitting the reload event --- mobile/lib/domain/services/timeline.service.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mobile/lib/domain/services/timeline.service.dart b/mobile/lib/domain/services/timeline.service.dart index 1c66e76bdf..b3d6b51402 100644 --- a/mobile/lib/domain/services/timeline.service.dart +++ b/mobile/lib/domain/services/timeline.service.dart @@ -129,11 +129,11 @@ class TimelineService { if (totalAssets == 0) { _bufferOffset = 0; _buffer.clear(); - // When the buffer is empty or the old bufferOffset is greater than the new total assets, - // we need to reset the buffer and load the first batch of assets. } else { final int offset; final int count; + // When the buffer is empty or the old bufferOffset is greater than the new total assets, + // we need to reset the buffer and load the first batch of assets. if (_bufferOffset >= totalAssets || _buffer.isEmpty) { offset = 0; count = kTimelineAssetLoadBatchSize; @@ -148,9 +148,9 @@ class TimelineService { _bufferOffset = offset; } - EventStream.shared.emit(const TimelineReloadEvent()); // change the state's total assets count only after the buffer is reloaded _totalAssets = totalAssets; + EventStream.shared.emit(const TimelineReloadEvent()); }); }); }