-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix restoring offramp after a refresh #337
Conversation
✅ Deploy Preview for pendulum-pay ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
src/hooks/offramp/useMainProcess.ts
Outdated
setOnSelectedNetworkChange(resetOfframpingState); | ||
}, [setOnSelectedNetworkChange, resetOfframpingState]); | ||
// useEffect(() => { | ||
// setOnSelectedNetworkChange(resetOfframpingState); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not know why the act of passing this function triggers it, even though there is no network change.
@@ -129,10 +129,6 @@ export const useMainProcess = () => { | |||
setSigningPhase, | |||
]); | |||
|
|||
useEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per the previous comment, just setting setOnSelectedNetworkChange(resetOfframpingState);
causes it to trigger on mount, which removes a potential state that must be picked up for continuation.
Since the network selector is disabled during the off-ramp, I think we can remove this now.
If we still want to add it back in the future, a potential solution exists in this WIP PR, possible after merging this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch, you finally found the issue 🙏 Let's merge.
src/hooks/offramp/useMainProcess.ts
Outdated
@@ -183,7 +180,16 @@ export const useMainProcess = () => { | |||
// but we intentionally exclude them from the dependency array to prevent unnecessary re-renders. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: We can remove this comment if nothing is missing from the dependency array
Solves issue: Stuck after anchor completion.