Skip to content
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: cannot reconnect after cancelling modal #3835

Merged
merged 3 commits into from
Feb 10, 2025

Conversation

magiziz
Copy link
Contributor

@magiziz magiziz commented Feb 10, 2025

Description

Fixed an issue where if you open the modal and cancel right after you can't open again

Type of change

  • Chore (non-breaking change that addresses non-functional tasks, maintenance, or code quality improvements)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Associated Issues

For Linear issues: Closes APKT-2245

Copy link

linear bot commented Feb 10, 2025

Copy link

changeset-bot bot commented Feb 10, 2025

⚠️ No Changeset found

Latest commit: 26cb7a5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Feb 10, 2025

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

Name Status Preview Comments Updated (UTC)
appkit-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 10, 2025 2:22pm
appkit-ethers5-bera ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 10, 2025 2:22pm
appkit-laboratory ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 10, 2025 2:22pm
9 Skipped Deployments
Name Status Preview Comments Updated (UTC)
appkit-basic-ep ⬜️ Ignored (Inspect) Visit Preview Feb 10, 2025 2:22pm
appkit-basic-ep-example ⬜️ Ignored (Inspect) Feb 10, 2025 2:22pm
appkit-basic-example ⬜️ Ignored (Inspect) Visit Preview Feb 10, 2025 2:22pm
appkit-basic-sign-client-example ⬜️ Ignored (Inspect) Visit Preview Feb 10, 2025 2:22pm
appkit-basic-up-example ⬜️ Ignored (Inspect) Visit Preview Feb 10, 2025 2:22pm
appkit-vue-solana ⬜️ Ignored (Inspect) Feb 10, 2025 2:22pm
appkit-wagmi-cdn-example ⬜️ Ignored (Inspect) Feb 10, 2025 2:22pm
ethereum-provider-wagmi-example ⬜️ Ignored (Inspect) Visit Preview Feb 10, 2025 2:22pm
vue-wagmi-example ⬜️ Ignored (Inspect) Feb 10, 2025 2:22pm

@@ -16,7 +16,7 @@ export { AccountController }

// -- Types --------------------------------------------------------------------
export interface OpenOptions {
view:
view?:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made this optional since we no longer need to open ConnectingWalletConnectBasic as it's already handled in ModalContoller.open

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noticed this issue when i was on mobile and it didn't open AllWallets view

Copy link
Collaborator

Choose a reason for hiding this comment

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

these are internal options right? cause at a ModalController level we always require a view

Copy link
Contributor

Choose a reason for hiding this comment

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

these are internal options right

It'll change the API on the public methods. Let's make sure it's not breaking anything for end users

Copy link
Contributor

Choose a reason for hiding this comment

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

What are the use cases users might want to call open without any params?

Also, the other params seems optional, does this requires passing empty object to the open function? Like

modal.open({ }) // we shouldn't require object if all props are optional

This should be available and happy with TS:

modal.open()  

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With WCM deprecation there are a few scenarios that users might pass either view or uri

If user wants to manually control the modal flow and they use ethereum provider, sign client or basic they'd call this

modal.open({ uri })

If user uses appkit directly and they want to open any available screen

modal.open({ view: 'Swap' )}

Both should be optional, but yes in most cases users just need to call modal.open()

// Button handlers
document.getElementById('connect')?.addEventListener('click', async () => {
setLoading(true)
await modal.open()
modal.subscribeEvents(({ data }) => data.event === 'MODAL_CLOSE' && setLoading(false))
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we avoid using inline if's?

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.

3 participants