Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3184152
D9685.id32995.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D9685.id32995.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D9685: [lib][web][native] Refactor updatesCurrentAsOfSelector
Attached
Detach File
Event Timeline
Log In to Comment