timeline: prevent unnecessary promises
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/807/merge
parent
b04586ba34
commit
cba3e1faeb
|
@ -962,14 +962,15 @@ export default defineComponent({
|
||||||
// Get local images if we are running in native environment.
|
// Get local images if we are running in native environment.
|
||||||
// Get them all together for each day here.
|
// Get them all together for each day here.
|
||||||
if (this.routeHasNative) {
|
if (this.routeHasNative) {
|
||||||
await Promise.all(
|
const promises = Array.from(dayMap.entries())
|
||||||
Array.from(dayMap.entries()).map(async ([dayId, photos]) => {
|
.filter(([dayId, photos]) => {
|
||||||
if (this.heads[dayId]?.day?.haslocal) {
|
return this.heads[dayId]?.day?.haslocal;
|
||||||
nativex.processFreshServerDay(dayId, photos);
|
|
||||||
nativex.mergeDay(photos, await nativex.getLocalDay(dayId));
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
);
|
.map(async ([dayId, photos]) => {
|
||||||
|
nativex.processFreshServerDay(dayId, photos);
|
||||||
|
nativex.mergeDay(photos, await nativex.getLocalDay(dayId));
|
||||||
|
});
|
||||||
|
if (promises.length) await Promise.all(promises);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process each day as needed
|
// Process each day as needed
|
||||||
|
|
Loading…
Reference in New Issue