Skip to content

Commit

Permalink
[web] Show loading state during siwe_auth server call
Browse files Browse the repository at this point in the history
Summary: Solves [ENG-4326](https://linear.app/comm/issue/ENG-4326/add-loading-indicator-for-web-siwe-flow). We should show some sort of loading state while the server call is ongoing.

Test Plan: {F678299}

Reviewers: atul, ginsu

Reviewed By: ginsu

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D8754
  • Loading branch information
Ashoat committed Aug 8, 2023
1 parent 67f0fc6 commit a3a219a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion web/account/siwe-login-form.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ type SIWELoginFormProps = {
const getSIWENonceLoadingStatusSelector = createLoadingStatusSelector(
getSIWENonceActionTypes,
);
const siweAuthLoadingStatusSelector =
createLoadingStatusSelector(siweAuthActionTypes);
function SIWELoginForm(props: SIWELoginFormProps): React.Node {
const { address } = useAccount();
const { data: signer } = useSigner();
Expand All @@ -55,6 +57,7 @@ function SIWELoginForm(props: SIWELoginFormProps): React.Node {
const getSIWENonceCallLoadingStatus = useSelector(
getSIWENonceLoadingStatusSelector,
);
const siweAuthLoadingStatus = useSelector(siweAuthLoadingStatusSelector);
const siweAuthCall = useServerCall(siweAuth);
const logInExtraInfo = useSelector(webLogInExtraInfoSelector);

Expand Down Expand Up @@ -153,7 +156,12 @@ function SIWELoginForm(props: SIWELoginFormProps): React.Node {
[],
);

if (!siweNonce || !primaryIdentityPublicKeys || !signedIdentityKeysBlob) {
if (
siweAuthLoadingStatus === 'loading' ||
!siweNonce ||
!primaryIdentityPublicKeys ||
!signedIdentityKeysBlob
) {
return (
<div className={css.loadingIndicator}>
<LoadingIndicator status="loading" size="large" />
Expand Down

0 comments on commit a3a219a

Please sign in to comment.