Changeset View
Changeset View
Standalone View
Standalone View
keyserver/src/socket/socket.js
Show All 11 Lines | import { | ||||
serverRequestSocketTimeout, | serverRequestSocketTimeout, | ||||
serverResponseTimeout, | serverResponseTimeout, | ||||
} from 'lib/shared/timeouts.js'; | } from 'lib/shared/timeouts.js'; | ||||
import { mostRecentUpdateTimestamp } from 'lib/shared/update-utils.js'; | import { mostRecentUpdateTimestamp } from 'lib/shared/update-utils.js'; | ||||
import type { Shape } from 'lib/types/core.js'; | import type { Shape } from 'lib/types/core.js'; | ||||
import { endpointIsSocketSafe } from 'lib/types/endpoints.js'; | import { endpointIsSocketSafe } from 'lib/types/endpoints.js'; | ||||
import { defaultNumberPerThread } from 'lib/types/message-types.js'; | import { defaultNumberPerThread } from 'lib/types/message-types.js'; | ||||
import { redisMessageTypes, type RedisMessage } from 'lib/types/redis-types.js'; | import { redisMessageTypes, type RedisMessage } from 'lib/types/redis-types.js'; | ||||
import { serverRequestTypes } from 'lib/types/request-types.js'; | |||||
import { | import { | ||||
cookieSources, | cookieSources, | ||||
sessionCheckFrequency, | sessionCheckFrequency, | ||||
stateCheckInactivityActivationInterval, | stateCheckInactivityActivationInterval, | ||||
} from 'lib/types/session-types.js'; | } from 'lib/types/session-types.js'; | ||||
import { | import { | ||||
type ClientSocketMessage, | type ClientSocketMessage, | ||||
type InitialClientSocketMessage, | type InitialClientSocketMessage, | ||||
▲ Show 20 Lines • Show All 422 Lines • ▼ Show 20 Lines | const messagesResult = { | ||||
rawMessageInfos: fetchMessagesResult.rawMessageInfos, | rawMessageInfos: fetchMessagesResult.rawMessageInfos, | ||||
truncationStatuses: fetchMessagesResult.truncationStatuses, | truncationStatuses: fetchMessagesResult.truncationStatuses, | ||||
currentAsOf: mostRecentMessageTimestamp( | currentAsOf: mostRecentMessageTimestamp( | ||||
fetchMessagesResult.rawMessageInfos, | fetchMessagesResult.rawMessageInfos, | ||||
oldMessagesCurrentAsOf, | oldMessagesCurrentAsOf, | ||||
), | ), | ||||
}; | }; | ||||
if ( | |||||
viewer.userAgent?.includes('Electron') && | |||||
ashoat: I might be wrong, but I think if `viewer.userAgent` is not set, you'll need optional chaining… | |||||
michalAuthorUnsubmitted Done Inline ActionsI tested it and it seems that if viewer.userAgent isn't set the call expression will evaluate to undefined. Flow also types it as void | boolean michal: I tested it and it seems that if `viewer.userAgent` isn't set the call expression will evaluate… | |||||
ashoatUnsubmitted Not Done Inline ActionsThanks for checking! ashoat: Thanks for checking! | |||||
viewer.platform === 'web' && | |||||
!serverRequests.find( | |||||
request => request.type === serverRequestTypes.PLATFORM_DETAILS, | |||||
) | |||||
) { | |||||
serverRequests.push({ type: serverRequestTypes.PLATFORM_DETAILS }); | |||||
} | |||||
if (!sessionInitializationResult.sessionContinued) { | if (!sessionInitializationResult.sessionContinued) { | ||||
const [threadsResult, entriesResult, currentUserInfo, knownUserInfos] = | const [threadsResult, entriesResult, currentUserInfo, knownUserInfos] = | ||||
await Promise.all([ | await Promise.all([ | ||||
fetchThreadInfos(viewer), | fetchThreadInfos(viewer), | ||||
fetchEntryInfos(viewer, [calendarQuery]), | fetchEntryInfos(viewer, [calendarQuery]), | ||||
fetchCurrentUserInfo(viewer), | fetchCurrentUserInfo(viewer), | ||||
fetchKnownUserInfos(viewer), | fetchKnownUserInfos(viewer), | ||||
]); | ]); | ||||
▲ Show 20 Lines • Show All 346 Lines • Show Last 20 Lines |
I might be wrong, but I think if viewer.userAgent is not set, you'll need optional chaining on the function invocation as well