mirror of
https://github.com/immich-app/immich.git
synced 2025-07-09 03:04:16 -04:00
change total assets before emitting the reload event
This commit is contained in:
parent
9ab0c604ea
commit
e375736f27
@ -129,11 +129,11 @@ class TimelineService {
|
|||||||
if (totalAssets == 0) {
|
if (totalAssets == 0) {
|
||||||
_bufferOffset = 0;
|
_bufferOffset = 0;
|
||||||
_buffer.clear();
|
_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 {
|
} else {
|
||||||
final int offset;
|
final int offset;
|
||||||
final int count;
|
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) {
|
if (_bufferOffset >= totalAssets || _buffer.isEmpty) {
|
||||||
offset = 0;
|
offset = 0;
|
||||||
count = kTimelineAssetLoadBatchSize;
|
count = kTimelineAssetLoadBatchSize;
|
||||||
@ -148,9 +148,9 @@ class TimelineService {
|
|||||||
_bufferOffset = offset;
|
_bufferOffset = offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
EventStream.shared.emit(const TimelineReloadEvent());
|
|
||||||
// change the state's total assets count only after the buffer is reloaded
|
// change the state's total assets count only after the buffer is reloaded
|
||||||
_totalAssets = totalAssets;
|
_totalAssets = totalAssets;
|
||||||
|
EventStream.shared.emit(const TimelineReloadEvent());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user