Page MenuHomePhabricator

D11200.id37712.diff
No OneTemporary

D11200.id37712.diff

diff --git a/lib/utils/identity-search-utils.js b/lib/utils/identity-search-utils.js
--- a/lib/utils/identity-search-utils.js
+++ b/lib/utils/identity-search-utils.js
@@ -4,16 +4,20 @@
import * as React from 'react';
import { usingCommServicesAccessToken } from './services-utils.js';
+import { isLoggedIn } from '../selectors/user-selectors.js';
import { IdentityClientContext } from '../shared/identity-client-context.js';
import { type IdentitySearchAuthMessage } from '../types/identity-search/auth-message-types.js';
+import { useSelector } from '../utils/redux-utils.js';
export function useGetIdentitySearchAuthMessage(): () => Promise<?IdentitySearchAuthMessage> {
+ const loggedIn = useSelector(isLoggedIn);
+
const identityContext = React.useContext(IdentityClientContext);
invariant(identityContext, 'Identity context should be set');
const getAuthMetadata = identityContext.getAuthMetadata;
return React.useCallback(async () => {
- if (!getAuthMetadata || !usingCommServicesAccessToken) {
+ if (!loggedIn || !usingCommServicesAccessToken) {
return null;
}
@@ -24,6 +28,7 @@
!authMetadata.deviceID ||
!authMetadata.accessToken
) {
+ console.log('Error getting auth message: authMetadata incomplete');
return null;
}
@@ -33,5 +38,5 @@
deviceID: authMetadata?.deviceID,
accessToken: authMetadata?.accessToken,
};
- }, [getAuthMetadata]);
+ }, [getAuthMetadata, loggedIn]);
}

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 2:35 AM (21 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2573562
Default Alt Text
D11200.id37712.diff (1 KB)

Event Timeline