Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions src/components/Mailbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -201,17 +201,24 @@ export default {
this.stopInterval()
},
methods: {
initializeCache() {
async initializeCache() {
if (this.loadingCacheInitialization) {
logger.debug('Cache initialization in progress, skipping envelope fetch')
return
}
this.loadingCacheInitialization = true
this.error = false

logger.debug(`syncing folder ${this.mailbox.databaseId} (${this.query}) during cache initalization`)
this.sync(true)
.then(() => {
this.loadingCacheInitialization = false

return this.loadEnvelopes()
})
logger.debug(`syncing folder ${this.mailbox.databaseId} (${this.query}) during cache initialization`)
try {
await this.sync(true)
await this.loadEnvelopes()
} catch (error) {
logger.error(`Could not initialize cache of folder ${this.mailbox.databaseId} (${this.searchQuery})`, { error })
this.error = error
} finally {
this.loadingCacheInitialization = false
}
},
async loadEnvelopes() {
logger.debug(`Fetching envelopes for folder ${this.mailbox.databaseId} (${this.searchQuery})`, this.mailbox)
Expand Down
Loading