diff --git a/web/redux/initial-state-gate.js b/web/redux/initial-state-gate.js --- a/web/redux/initial-state-gate.js +++ b/web/redux/initial-state-gate.js @@ -8,7 +8,7 @@ import type { ThreadStoreOperation } from 'lib/ops/thread-store-ops.js'; import { allUpdatesCurrentAsOfSelector } from 'lib/selectors/keyserver-selectors.js'; import { canUseDatabaseOnWeb } from 'lib/shared/web-database.js'; -import type { LegacyRawThreadInfo } from 'lib/types/thread-types.js'; +import type { RawThreadInfo } from 'lib/types/thread-types.js'; import { convertIDToNewSchema } from 'lib/utils/migration-utils.js'; import { entries } from 'lib/utils/objects.js'; import { useDispatch } from 'lib/utils/redux-utils.js'; @@ -97,7 +97,7 @@ const threadStoreOperations: ThreadStoreOperation[] = entries( threadInfos, - ).map(([id, threadInfo]: [string, LegacyRawThreadInfo]) => ({ + ).map(([id, threadInfo]: [string, RawThreadInfo]) => ({ type: 'replace', payload: { id, diff --git a/web/redux/redux-setup.js b/web/redux/redux-setup.js --- a/web/redux/redux-setup.js +++ b/web/redux/redux-setup.js @@ -295,19 +295,37 @@ state.threadStore.threadInfos[activeThread].currentUser.unread ) { // Makes sure a currently focused thread is never unread - updateActiveThreadOps.push({ - type: 'replace', - payload: { - id: activeThread, - threadInfo: { - ...state.threadStore.threadInfos[activeThread], - currentUser: { - ...state.threadStore.threadInfos[activeThread].currentUser, - unread: false, + const activeThreadInfo = state.threadStore.threadInfos[activeThread]; + // TODO (atul): Try to get rid of this ridiculous branching. + if (activeThreadInfo.minimallyEncoded) { + updateActiveThreadOps.push({ + type: 'replace', + payload: { + id: activeThread, + threadInfo: { + ...activeThreadInfo, + currentUser: { + ...activeThreadInfo.currentUser, + unread: false, + }, }, }, - }, - }); + }); + } else { + updateActiveThreadOps.push({ + type: 'replace', + payload: { + id: activeThread, + threadInfo: { + ...activeThreadInfo, + currentUser: { + ...activeThreadInfo.currentUser, + unread: false, + }, + }, + }, + }); + } } const oldActiveThread = activeThreadSelector(oldState);