Skip to content

Commit

Permalink
[landing] Fix ConnectFarcaster
Browse files Browse the repository at this point in the history
Summary: Addresses [ENG-9506](https://linear.app/comm/issue/ENG-9506/farcaster-login-issues). @horsefacts helped me out here. We should be waiting for `connect` to finish before calling `signIn`.

Test Plan: I tested the SIWF flow on Android following [this doc](https://www.notion.so/commapp/How-to-test-Farcaster-connect-screen-114d823c518b80cf9b10da4d961bc807)

Reviewers: varun, will

Reviewed By: varun

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D13620
  • Loading branch information
Ashoat committed Oct 4, 2024
1 parent 625e738 commit 25c1c1f
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions landing/connect-farcaster.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ function ConnectFarcaster(): React.Node {
validSignature,
} = signInState;

React.useEffect(() => {
if (!channelToken) {
connect();
}
}, [channelToken, connect]);

const messageSentRef = React.useRef<boolean>(false);
const authenticated = isSuccess && validSignature;

Expand All @@ -57,6 +51,8 @@ function ConnectFarcaster(): React.Node {
if (isError) {
messageSentRef.current = false;
reconnect();
} else if (!channelToken) {
connect();
}

signIn();
Expand All @@ -69,7 +65,7 @@ function ConnectFarcaster(): React.Node {
url: url.toString(),
});
}
}, [authenticated, isError, reconnect, signIn, url]);
}, [authenticated, isError, reconnect, channelToken, connect, signIn, url]);

return null;
}
Expand Down

0 comments on commit 25c1c1f

Please sign in to comment.