Page MenuHomePhabricator

D9685.id32995.diff
No OneTemporary

D9685.id32995.diff

diff --git a/lib/selectors/keyserver-selectors.js b/lib/selectors/keyserver-selectors.js
--- a/lib/selectors/keyserver-selectors.js
+++ b/lib/selectors/keyserver-selectors.js
@@ -33,11 +33,14 @@
const sessionIDSelector: (state: AppState) => ?string = (state: AppState) =>
state.keyserverStore.keyserverInfos[ashoatKeyserverID]?.sessionID;
-const updatesCurrentAsOfSelector: (state: AppState) => number = (
- state: AppState,
-) =>
- state.keyserverStore.keyserverInfos[ashoatKeyserverID]?.updatesCurrentAsOf ??
- 0;
+const baseUpdatesCurrentAsOfSelector: (
+ keyserverID: string,
+) => (state: AppState) => number = keyserverID => (state: AppState) =>
+ state.keyserverStore.keyserverInfos[keyserverID]?.updatesCurrentAsOf ?? 0;
+
+const updatesCurrentAsOfSelector: (
+ keyserverID: string,
+) => (state: AppState) => number = _memoize(baseUpdatesCurrentAsOfSelector);
const baseCurrentAsOfSelector: (
keyserverID: string,
diff --git a/lib/selectors/socket-selectors.js b/lib/selectors/socket-selectors.js
--- a/lib/selectors/socket-selectors.js
+++ b/lib/selectors/socket-selectors.js
@@ -201,7 +201,7 @@
) => (calendarActive: boolean) => SessionState = keyserverID =>
createSelector(
currentAsOfSelector(keyserverID),
- updatesCurrentAsOfSelector,
+ updatesCurrentAsOfSelector(keyserverID),
currentCalendarQuery,
(
messagesCurrentAsOf: number,
diff --git a/native/push/push-handler.react.js b/native/push/push-handler.react.js
--- a/native/push/push-handler.react.js
+++ b/native/push/push-handler.react.js
@@ -693,7 +693,9 @@
);
const connection = useSelector(connectionSelector(ashoatKeyserverID));
invariant(connection, 'keyserver missing from keyserverStore');
- const updatesCurrentAsOf = useSelector(updatesCurrentAsOfSelector);
+ const updatesCurrentAsOf = useSelector(
+ updatesCurrentAsOfSelector(ashoatKeyserverID),
+ );
const activeTheme = useSelector(state => state.globalThemeInfo.activeTheme);
const loggedIn = useSelector(isLoggedIn);
const navigateToThread = useNavigateToThread();

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 9, 10:16 AM (19 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2449912
Default Alt Text
D9685.id32995.diff (2 KB)

Event Timeline