-
Notifications
You must be signed in to change notification settings - Fork 26
refactor: move the subscription complete handler on useEffect #392
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -99,6 +93,12 @@ const AppCard: React.FC<AppCardProps> = ({ | |||
} | |||
} | |||
|
|||
useEffect(() => { | |||
if (subscribing && subscribed) { | |||
showSuccessMessageToast(`Subscribed to ${name}`) |
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.
@devceline Should we call the setSubscribing(false)
in this block as well? Seems like we don't set it to false
if no error occurs.
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 don't think it matters because subscribed
would be true
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.
Lets double make sure it's not gonna retriggered
@@ -99,6 +93,12 @@ const AppCard: React.FC<AppCardProps> = ({ | |||
} | |||
} | |||
|
|||
useEffect(() => { | |||
if (subscribing && subscribed) { | |||
showSuccessMessageToast(`Subscribed to ${name}`) |
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 don't think it matters because subscribed
would be true
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.
Reviewed
Description
Since we're calling the
handleSubmit
at once and thesubscribed
andsubscribing
values changing over time. We should watch these values inuseEffect
to handle subscribed state and take action (like show a toast message).Type of change
Fixes/Resolves (Optional)
Closes https://github.com/WalletConnect/web3inbox-planning/issues/51
Examples/Screenshots (Optional)
Screen.Recording.2024-01-13.at.17.20.25.mov
Checklist: