Skip to content

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

Merged
merged 4 commits into from
Jan 13, 2024

Conversation

enesozturk
Copy link
Contributor

Description

Since we're calling the handleSubmit at once and the subscribed and subscribing values changing over time. We should watch these values in useEffect to handle subscribed state and take action (like show a toast message).

Type of change

  • Bug fix (non-breaking change which fixes an issue)

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:

  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

@enesozturk enesozturk requested a review from devceline January 13, 2024 14:21
Copy link

vercel bot commented Jan 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
app-web3inbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 13, 2024 3:10pm

@@ -99,6 +93,12 @@ const AppCard: React.FC<AppCardProps> = ({
}
}

useEffect(() => {
if (subscribing && subscribed) {
showSuccessMessageToast(`Subscribed to ${name}`)
Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor Author

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}`)
Copy link
Contributor

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

Copy link
Contributor Author

@enesozturk enesozturk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed

@enesozturk enesozturk merged commit b6b724e into main Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants