Skip to content

Commit

Permalink
Wait for wallet connection
Browse files Browse the repository at this point in the history
  • Loading branch information
TorstenStueber committed Nov 8, 2024
1 parent 23e363e commit 2e0dc8d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/hooks/useMainProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ export const useMainProcess = () => {
}, [updateHookStateFromState, offrampingState]);

useEffect(() => {
if (wagmiConfig.state.status !== 'connected') return;

(async () => {
const nextState = await advanceOfframpingState(offrampingState, {
renderEvent: addEvent,
Expand All @@ -267,7 +269,13 @@ export const useMainProcess = () => {

if (offrampingState !== nextState) updateHookStateFromState(nextState);
})();
}, [offrampingState, updateHookStateFromState, trackEvent, wagmiConfig]);
}, [
offrampingState,
updateHookStateFromState,
trackEvent,
wagmiConfig,
wagmiConfig.state.status, // wagmiConfig is a mutable object so we need to list wagmiConfig.state.status here
]);

return {
handleOnSubmit,
Expand Down

0 comments on commit 2e0dc8d

Please sign in to comment.