Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3158179
D10664.id35808.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
D10664.id35808.diff
View Options
diff --git a/lib/shared/identity-client-context.js b/lib/shared/identity-client-context.js
--- a/lib/shared/identity-client-context.js
+++ b/lib/shared/identity-client-context.js
@@ -5,7 +5,7 @@
import type { IdentityServiceClient } from '../types/identity-service-types.js';
export type IdentityClientContextType = {
- +identityClient: ?IdentityServiceClient,
+ +identityClient: IdentityServiceClient,
};
const IdentityClientContext: React.Context<?IdentityClientContextType> =
diff --git a/native/identity-service/identity-service-context-provider.react.js b/native/identity-service/identity-service-context-provider.react.js
--- a/native/identity-service/identity-service-context-provider.react.js
+++ b/native/identity-service/identity-service-context-provider.react.js
@@ -62,8 +62,8 @@
return { deviceID, userID, accessToken };
}, []);
- const client = React.useMemo<?IdentityServiceClient>(() => {
- return {
+ const client = React.useMemo<IdentityServiceClient>(
+ () => ({
deleteUser: async () => {
const { deviceID, userID, accessToken } = await getAuthMetadata();
return commRustModule.deleteUser(userID, deviceID, accessToken);
@@ -117,8 +117,9 @@
const { userID, accessToken } = JSON.parse(registrationResult);
return { accessToken, userID, username };
},
- };
- }, [getAuthMetadata]);
+ }),
+ [getAuthMetadata],
+ );
const value = React.useMemo(
() => ({
diff --git a/web/grpc/identity-service-context-provider.react.js b/web/grpc/identity-service-context-provider.react.js
--- a/web/grpc/identity-service-context-provider.react.js
+++ b/web/grpc/identity-service-context-provider.react.js
@@ -3,7 +3,6 @@
import * as React from 'react';
import { IdentityClientContext } from 'lib/shared/identity-client-context.js';
-import type { IdentityServiceClient } from 'lib/types/identity-service-types.js';
import { IdentityServiceClientWrapper } from './identity-service-client-wrapper.js';
import { useSelector } from '../redux/redux-utils.js';
@@ -13,7 +12,6 @@
};
function IdentityServiceContextProvider(props: Props): React.Node {
const { children } = props;
- const [client, setClient] = React.useState<?IdentityServiceClient>();
const userID = useSelector(state => state.currentUserInfo?.id);
const accessToken = useSelector(state => state.commServicesAccessToken);
@@ -21,7 +19,7 @@
state => state.cryptoStore?.primaryIdentityKeys.ed25519,
);
- React.useEffect(() => {
+ const client = React.useMemo(() => {
let authLayer = null;
if (userID && deviceID && accessToken) {
authLayer = {
@@ -30,7 +28,7 @@
commServicesAccessToken: accessToken,
};
}
- setClient(new IdentityServiceClientWrapper(authLayer));
+ return new IdentityServiceClientWrapper(authLayer);
}, [accessToken, deviceID, userID]);
const value = React.useMemo(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 6, 9:30 PM (17 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2432591
Default Alt Text
D10664.id35808.diff (2 KB)
Attached To
Mode
D10664: [native][web] Make identity client mandatory
Attached
Detach File
Event Timeline
Log In to Comment