diff --git a/lib/reducers/thread-reducer.js b/lib/reducers/thread-reducer.js --- a/lib/reducers/thread-reducer.js +++ b/lib/reducers/thread-reducer.js @@ -94,16 +94,10 @@ { type: 'remove_all', }, - ...Object.keys(newThreadInfos).map((id: string) => { - invariant( - newThreadInfos[id].minimallyEncoded, - 'newThreadInfos must be minimallyEncoded for current clients', - ); - return { - type: 'replace', - payload: { id, threadInfo: newThreadInfos[id] }, - }; - }), + ...Object.keys(newThreadInfos).map((id: string) => ({ + type: 'replace', + payload: { id, threadInfo: newThreadInfos[id] }, + })), ]; const updatedThreadStore = processThreadStoreOperations( state, diff --git a/lib/types/socket-types.js b/lib/types/socket-types.js --- a/lib/types/socket-types.js +++ b/lib/types/socket-types.js @@ -33,7 +33,10 @@ type ClientClientResponse, } from './request-types.js'; import type { SessionState, SessionIdentification } from './session-types.js'; -import { type RawThreadInfos } from './thread-types.js'; +import type { + RawThreadInfos, + MinimallyEncodedRawThreadInfos, +} from './thread-types.js'; import { type ClientUpdatesResult, type ClientUpdatesResultWithUserInfos, @@ -184,14 +187,12 @@ export const fullStateSyncActionType = 'FULL_STATE_SYNC'; export type BaseFullStateSync = { +messagesResult: MessagesResponse, - +threadInfos: RawThreadInfos, +rawEntryInfos: $ReadOnlyArray, +userInfos: $ReadOnlyArray, +updatesCurrentAsOf: number, }; const baseFullStateSyncValidator = tShape({ messagesResult: messagesResponseValidator, - threadInfos: t.dict(tID, rawThreadInfoValidator), rawEntryInfos: t.list(rawEntryInfoValidator), userInfos: t.list(userInfoValidator), updatesCurrentAsOf: t.Number, @@ -199,6 +200,7 @@ export type ClientFullStateSync = { ...BaseFullStateSync, + +threadInfos: MinimallyEncodedRawThreadInfos, +currentUserInfo: CurrentUserInfo, }; export type StateSyncFullActionPayload = { @@ -215,10 +217,12 @@ export type ServerFullStateSync = { ...BaseFullStateSync, + +threadInfos: RawThreadInfos, +currentUserInfo: CurrentUserInfo, }; const serverFullStateSyncValidator = tShape({ ...baseFullStateSyncValidator.meta.props, + threadInfos: t.dict(tID, rawThreadInfoValidator), currentUserInfo: currentUserInfoValidator, });