diff --git a/native/calendar/entry.react.js b/native/calendar/entry.react.js --- a/native/calendar/entry.react.js +++ b/native/calendar/entry.react.js @@ -26,6 +26,7 @@ useDeleteEntry, useSaveEntry, } from 'lib/actions/entry-actions.js'; +import { extractKeyserverIDFromID } from 'lib/keyserver-conn/keyserver-call-utils.js'; import { registerFetchKey } from 'lib/reducers/loading-reducer.js'; import { connectionSelector } from 'lib/selectors/keyserver-selectors.js'; import { colorIsDark } from 'lib/shared/color-utils.js'; @@ -60,7 +61,6 @@ import type { EntryInfoWithHeight } from './calendar.react.js'; import LoadingIndicator from './loading-indicator.react.js'; -import { authoritativeKeyserverID } from '../authoritative-keyserver.js'; import { type MessageListParams, useNavigateToThread, @@ -783,11 +783,6 @@ navContext, }), ); - const connection = useSelector( - connectionSelector(authoritativeKeyserverID), - ); - invariant(connection, 'keyserver missing from keyserverStore'); - const online = connection.status === 'connected'; const styles = useStyles(unboundStyles); const navigateToThread = useNavigateToThread(); @@ -801,6 +796,14 @@ const { threadInfo: unresolvedThreadInfo, ...restProps } = props; const threadInfo = useResolvedThreadInfo(unresolvedThreadInfo); + const keyserverID = extractKeyserverIDFromID(threadInfo.id); + const connection = useSelector(connectionSelector(keyserverID)); + invariant( + connection, + `keyserver ${keyserverID} missing from keyserverStore`, + ); + const online = connection.status === 'connected'; + return ( <InternalEntry {...restProps} diff --git a/web/calendar/entry.react.js b/web/calendar/entry.react.js --- a/web/calendar/entry.react.js +++ b/web/calendar/entry.react.js @@ -17,6 +17,7 @@ type PushModal, useModalContext, } from 'lib/components/modal-provider.react.js'; +import { extractKeyserverIDFromID } from 'lib/keyserver-conn/keyserver-call-utils.js'; import { connectionSelector } from 'lib/selectors/keyserver-selectors.js'; import { threadInfoSelector } from 'lib/selectors/thread-selectors.js'; import { colorIsDark } from 'lib/shared/color-utils.js'; @@ -47,7 +48,6 @@ import { useDispatch } from 'lib/utils/redux-utils.js'; import css from './calendar.css'; -import { authoritativeKeyserverID } from '../authoritative-keyserver.js'; import LoadingIndicator from '../loading-indicator.react.js'; import LogInFirstModal from '../modals/account/log-in-first-modal.react.js'; import ConcurrentModificationModal from '../modals/concurrent-modification-modal.react.js'; @@ -472,10 +472,12 @@ !!(state.currentUserInfo && !state.currentUserInfo.anonymous && true), ); const calendarQuery = useSelector(nonThreadCalendarQuery); - const connection = useSelector( - connectionSelector(authoritativeKeyserverID), + const keyserverID = extractKeyserverIDFromID(threadID); + const connection = useSelector(connectionSelector(keyserverID)); + invariant( + connection, + `keyserver ${keyserverID} missing from keyserverStore`, ); - invariant(connection, 'keyserver missing from keyserverStore'); const online = connection.status === 'connected'; const callCreateEntry = useCreateEntry(); const callSaveEntry = useSaveEntry();