From 5cae7f4fe75e5486334dbe6efd3147c2a5585125 Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Sat, 3 Feb 2018 09:35:10 -0800 Subject: [PATCH] =?UTF-8?q?Clear=20the=20=E2=80=9Cmarked=20as=20read?= =?UTF-8?q?=E2=80=9D=20state=20so=20drilling=20back=20into=20a=20thread=20?= =?UTF-8?q?marks=20it=20again=20#617?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/flux/stores/message-store.es6 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/flux/stores/message-store.es6 b/app/src/flux/stores/message-store.es6 index 3fb5cac92..1e1a43fca 100644 --- a/app/src/flux/stores/message-store.es6 +++ b/app/src/flux/stores/message-store.es6 @@ -168,7 +168,12 @@ class MessageStore extends MailspringStore { _onApplyFocusChange() { const focused = FocusedContentStore.focused('thread'); - if (this.threadId() === (focused ? focused.id : undefined)) return; + if (focused === null) { + this._lastMarkedAsReadThreadId = null; + } + + // if we already match the desired state, no need to trigger + if (this.threadId() === (focused || {}).id) return; this._thread = focused; this._items = []; @@ -195,8 +200,8 @@ class MessageStore extends MailspringStore { // prompts (since this is a passive action vs. a user-triggered // action.) if (!this._thread) return; - if (this._lastLoadedThreadId === this._thread.id) return; - this._lastLoadedThreadId = this._thread.id; + if (this._lastMarkedAsReadThreadId === this._thread.id) return; + this._lastMarkedAsReadThreadId = this._thread.id; if (this._thread.unread) { const markAsReadDelay = AppEnv.config.get('core.reading.markAsReadDelay');