From 84628f35b0ab6eb36e9caea79436eff2888b14cb Mon Sep 17 00:00:00 2001 From: greta Date: Mon, 2 Sep 2024 12:17:06 +0200 Subject: [PATCH] fix: thread disappearing after refresh Signed-off-by: greta --- src/components/MailboxThread.vue | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/components/MailboxThread.vue b/src/components/MailboxThread.vue index 364fb7e144..70320a75c8 100644 --- a/src/components/MailboxThread.vue +++ b/src/components/MailboxThread.vue @@ -196,10 +196,14 @@ export default { watch: { $route() { this.handleMailto() + if (this.isThreadShown) { + this.fetchEnvelopes() + } }, mailbox() { clearTimeout(this.startMailboxTimer) setTimeout(this.saveStartMailbox, START_MAILBOX_DEBOUNCE) + this.fetchEnvelopes() }, }, created() { @@ -207,11 +211,23 @@ export default { }, mounted() { setTimeout(this.saveStartMailbox, START_MAILBOX_DEBOUNCE) + if (this.isThreadShown) { + this.fetchEnvelopes() + } }, beforeUnmount() { clearTimeout(this.startMailboxTimer) }, methods: { + async fetchEnvelopes() { + const existingEnvelopes = this.$store.getters.getEnvelopes(this.mailbox.databaseId, this.searchQuery || '') + if (!existingEnvelopes.length) { + await this.$store.dispatch('fetchEnvelopes', { + mailboxId: this.mailbox.databaseId, + query: this.searchQuery || '', + }) + } + }, deleteMessage(id) { this.bus.emit('delete', id) },