Page MenuHomePhabricator

D10277.diff
No OneTemporary

D10277.diff

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);

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 6, 7:46 PM (20 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2431878
Default Alt Text
D10277.diff (2 KB)

Event Timeline