`);
const statePromises = {
navInfo: navInfoPromise,
currentUserInfo: ((currentUserInfoPromise: any): Promise
),
sessionID: sessionIDPromise,
entryStore: entryStorePromise,
threadStore: threadStorePromise,
userStore: userStorePromise,
messageStore: messageStorePromise,
updatesCurrentAsOf: initialTime,
loadingStatuses: {},
calendarFilters: defaultCalendarFilters,
// We can use paths local to the on web
urlPrefix: '',
windowDimensions: { width: 0, height: 0 },
baseHref,
connection: {
...defaultConnectionInfo('web', viewer.timeZone),
actualizedCalendarQuery: calendarQuery,
},
watchedThreadIDs: [],
lifecycleState: 'active',
enabledApps: defaultWebEnabledApps,
reportStore: {
enabledReports: defaultEnabledReports,
queuedReports: [],
},
nextLocalID: 0,
timeZone: viewer.timeZone,
userAgent: viewer.userAgent,
cookie: undefined,
deviceToken: undefined,
dataLoaded: viewer.loggedIn,
windowActive: true,
};
const [stateResult, App] = await Promise.all([
promiseAll(statePromises),
appPromise,
]);
const state: AppState = { ...stateResult };
const store: Store = createStore(reducer, state);
const routerContext = {};
const clientPath = clientPathFromRouterPath(req.url, appURLFacts);
const reactStream = renderToNodeStream(
,
);
if (routerContext.url) {
throw new ServerError('URL modified during server render!');
}
reactStream.pipe(res, { end: false });
await waitForStream(reactStream);
res.write(html`
`);
}
export { websiteResponder };
diff --git a/lib/reducers/message-reducer.js b/lib/reducers/message-reducer.js
index c38bc61c1..32b51d3ce 100644
--- a/lib/reducers/message-reducer.js
+++ b/lib/reducers/message-reducer.js
@@ -1,1414 +1,1412 @@
// @flow
import invariant from 'invariant';
import _difference from 'lodash/fp/difference';
import _flow from 'lodash/fp/flow';
import _isEqual from 'lodash/fp/isEqual';
import _keyBy from 'lodash/fp/keyBy';
import _map from 'lodash/fp/map';
import _mapKeys from 'lodash/fp/mapKeys';
import _mapValues from 'lodash/fp/mapValues';
import _omit from 'lodash/fp/omit';
import _omitBy from 'lodash/fp/omitBy';
import _pick from 'lodash/fp/pick';
import _pickBy from 'lodash/fp/pickBy';
import _uniq from 'lodash/fp/uniq';
import {
createEntryActionTypes,
saveEntryActionTypes,
deleteEntryActionTypes,
restoreEntryActionTypes,
} from '../actions/entry-actions';
import {
fetchMessagesBeforeCursorActionTypes,
fetchMostRecentMessagesActionTypes,
sendTextMessageActionTypes,
sendMultimediaMessageActionTypes,
saveMessagesActionType,
processMessagesActionType,
messageStorePruneActionType,
createLocalMessageActionType,
fetchSingleMostRecentMessagesFromThreadsActionTypes,
setMessageStoreMessages,
} from '../actions/message-actions';
import {
changeThreadSettingsActionTypes,
deleteThreadActionTypes,
leaveThreadActionTypes,
newThreadActionTypes,
removeUsersFromThreadActionTypes,
changeThreadMemberRolesActionTypes,
joinThreadActionTypes,
} from '../actions/thread-actions';
import { updateMultimediaMessageMediaActionType } from '../actions/upload-actions';
import {
logOutActionTypes,
deleteAccountActionTypes,
logInActionTypes,
registerActionTypes,
} from '../actions/user-actions';
-import { locallyUniqueToRealizedThreadIDsSelector } from '../selectors/thread-selectors';
+import { pendingToRealizedThreadIDsSelector } from '../selectors/thread-selectors';
import {
messageID,
combineTruncationStatuses,
sortMessageInfoList,
sortMessageIDs,
mergeThreadMessageInfos,
} from '../shared/message-utils';
import {
threadHasPermission,
threadInChatList,
threadIsPending,
} from '../shared/thread-utils';
import threadWatcher from '../shared/thread-watcher';
import { unshimMessageInfos } from '../shared/unshim-utils';
import type { Media, Image } from '../types/media-types';
import {
type RawMessageInfo,
type LocalMessageInfo,
type MessageStore,
type ReplaceMessageOperation,
type MessageStoreOperation,
type MessageTruncationStatus,
type ThreadMessageInfo,
type MessageTruncationStatuses,
messageTruncationStatus,
messageTypes,
defaultNumberPerThread,
} from '../types/message-types';
import type { RawImagesMessageInfo } from '../types/messages/images';
import type { RawMediaMessageInfo } from '../types/messages/media';
import { type BaseAction } from '../types/redux-types';
import { processServerRequestsActionType } from '../types/request-types';
import {
fullStateSyncActionType,
incrementalStateSyncActionType,
} from '../types/socket-types';
import { type RawThreadInfo, threadPermissions } from '../types/thread-types';
import {
updateTypes,
type ClientUpdateInfo,
processUpdatesActionType,
} from '../types/update-types';
import { setNewSessionActionType } from '../utils/action-utils';
import { translateClientDBMessageInfosToRawMessageInfos } from '../utils/message-ops-utils';
const _mapValuesWithKeys = _mapValues.convert({ cap: false });
// Input must already be ordered!
function mapThreadsToMessageIDsFromOrderedMessageInfos(
orderedMessageInfos: $ReadOnlyArray