Skip to content

Conversation

@0xmkh
Copy link
Collaborator

@0xmkh 0xmkh commented Nov 27, 2025

Description

Fixed an issue where the embedded modal did not close properly after connecting

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)

Showcase (Optional)

If there is a UI change include the screenshots with before and after state.
If new feature is being introduced, include the link to demo recording.

Checklist

  • Code in this PR is covered by automated tests (Unit tests, E2E tests)
  • My changes generate no new warnings
  • I have reviewed my own code
  • I have filled out all required sections
  • I have tested my changes on the preview link
  • Approver of this PR confirms that the changes are tested on the preview link

Note

Fixes embedded modal not closing after connect and updates demo to patched packages; adds TON namespace in constants.

  • Scaffold UI (modal):
    • Adjust onNewAddress in packages/scaffold-ui/src/modal/w3m-modal/index.ts to close when embedded and a new caipAddress appears after a prior disconnect; rename shouldClose -> shouldCloseModal and import CoreHelperUtil.
  • Demo:
    • Add ton to NAMESPACE_NETWORK_IDS_MAP in apps/demo/lib/constants.ts.
    • Bump @reown/* dependencies to 1.8.14-embedded-mode-fix.0 in apps/demo/package.json (and testing package) to consume the fix.
  • Changeset:
    • Add patch releases across @reown/* packages noting the embedded modal close fix.

Written by Cursor Bugbot for commit a53ce1f. This will update automatically on new commits. Configure here.

@changeset-bot
Copy link

changeset-bot bot commented Nov 27, 2025

🦋 Changeset detected

Latest commit: a53ce1f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 26 packages
Name Type
@reown/appkit-scaffold-ui Patch
pay-test-exchange Patch
@reown/appkit-adapter-bitcoin Patch
@reown/appkit-adapter-ethers Patch
@reown/appkit-adapter-ethers5 Patch
@reown/appkit-adapter-solana Patch
@reown/appkit-adapter-ton Patch
@reown/appkit-adapter-wagmi Patch
@reown/appkit Patch
@reown/appkit-utils Patch
@reown/appkit-cdn Patch
@reown/appkit-cli Patch
@reown/appkit-codemod Patch
@reown/appkit-common Patch
@reown/appkit-controllers Patch
@reown/appkit-core Patch
@reown/appkit-experimental Patch
@reown/appkit-pay Patch
@reown/appkit-polyfills Patch
@reown/appkit-siwe Patch
@reown/appkit-siwx Patch
@reown/appkit-testing Patch
@reown/appkit-ui Patch
@reown/appkit-universal-connector Patch
@reown/appkit-wallet Patch
@reown/appkit-wallet-button Patch

Not sure what this means? Click here to learn what changesets are.

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

@vercel
Copy link

vercel bot commented Nov 27, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
appkit-basic-html Ready Ready Preview Comment Nov 27, 2025 2:23pm
appkit-demo Ready Ready Preview Comment Nov 27, 2025 2:23pm
appkit-gallery Ready Ready Preview Comment Nov 27, 2025 2:23pm
appkit-headless-sample-app Ready Ready Preview Comment Nov 27, 2025 2:23pm
appkit-laboratory Ready Ready Preview Comment Nov 27, 2025 2:23pm
10 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
appkit-basic-example Ignored Ignored Nov 27, 2025 2:23pm
appkit-basic-sign-client-example Ignored Ignored Nov 27, 2025 2:23pm
appkit-basic-up-example Ignored Ignored Nov 27, 2025 2:23pm
appkit-ethers5-bera Ignored Ignored Nov 27, 2025 2:23pm
appkit-nansen-demo Ignored Ignored Nov 27, 2025 2:23pm
appkit-vue-solana Ignored Ignored Nov 27, 2025 2:23pm
appkit-wagmi-cdn-example Ignored Ignored Nov 27, 2025 2:23pm
ethereum-provider-wagmi-example Ignored Ignored Nov 27, 2025 2:23pm
next-wagmi-solana-bitcoin-example Ignored Ignored Nov 27, 2025 2:23pm
vue-wagmi-example Ignored Ignored Nov 27, 2025 2:23pm

@socket-security
Copy link

socket-security bot commented Nov 27, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​reown/​appkit-adapter-ethers@​1.8.8 ⏵ 1.8.14-embedded-mode-fix.0911008398 +180
Updated@​reown/​appkit-adapter-solana@​1.8.8 ⏵ 1.8.14-embedded-mode-fix.0971008498 +180
Updated@​reown/​appkit-adapter-bitcoin@​1.8.8 ⏵ 1.8.14-embedded-mode-fix.090 -31008498 +180

View full report

Comment on lines +38 to +45
"@reown/appkit": "1.8.14-embedded-mode-fix.0",
"@reown/appkit-adapter-bitcoin": "1.8.14-embedded-mode-fix.0",
"@reown/appkit-adapter-ethers": "1.8.14-embedded-mode-fix.0",
"@reown/appkit-adapter-solana": "1.8.14-embedded-mode-fix.0",
"@reown/appkit-common": "1.8.14-embedded-mode-fix.0",
"@reown/appkit-controllers": "1.8.14-embedded-mode-fix.0",
"@reown/appkit-scaffold-ui": "1.8.14-embedded-mode-fix.0",
"@reown/appkit-ui": "1.8.14-embedded-mode-fix.0",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this a canary from the fix currently being implemented?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yep

@github-actions
Copy link
Contributor

github-actions bot commented Nov 27, 2025

Visual Regression Test Results ✅ Passed

✨ No visual changes detected

Chromatic Build: https://www.chromatic.com/build?appId=6493191bf4b10fed8ca7353f&number=467
Storybook Preview: https://6493191bf4b10fed8ca7353f-ixpuvgwudi.chromatic.com/

Comment on lines 247 to 258
const isSwitchingNamespace = ChainController.state.isSwitchingNamespace
const isInProfileView = RouterController.state.view === 'ProfileWallets'

const shouldClose = !caipAddress && !isSwitchingNamespace && !isInProfileView
if (shouldClose) {
const shouldCloseModal = !caipAddress && !isSwitchingNamespace && !isInProfileView

const hasPreviouslyDisconnected = !CoreHelperUtil.getPlainAddress(this.caipAddress)
const shouldCloseEmbeddedModal =
this.enableEmbedded && Boolean(caipAddress) && hasPreviouslyDisconnected

if (shouldCloseModal || shouldCloseEmbeddedModal) {
ModalController.close()
}
Copy link
Collaborator

@tomiir tomiir Nov 27, 2025

Choose a reason for hiding this comment

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

private async onNewAddress(newCaipAddress?: CaipAddress) {
  const oldAddress = CoreHelperUtil.getPlainAddress(this.caipAddress)
  const newAddress = CoreHelperUtil.getPlainAddress(newCaipAddress)

  const isSwitchingNamespace = ChainController.state.isSwitchingNamespace
  const isInProfileView = RouterController.state.view === 'ProfileWallets'

  const isDisconnectedAndIdle = !newAddress && !isSwitchingNamespace && !isInProfileView
  const isReconnect = this.enableEmbedded && !oldAddress && !!newAddress

  if (isDisconnectedAndIdle || isReconnect) {
    ModalController.close()
  }
}

can we apply something like this? think we should have more descriptive boolean names if we are introducing new conditions

Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe isreconnect is not the proper one but I think you get my point
shouldClose tells me nothing about why it should close

Copy link
Collaborator

@tomiir tomiir left a comment

Choose a reason for hiding this comment

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

Approved with one nit comment

@github-actions
Copy link
Contributor

📦 Bundle Size Check

All bundles are within size limits

📊 View detailed bundle sizes

> @reown/appkit-monorepo@1.7.1 size /home/runner/work/appkit/appkit


> size-limit

@reown/appkit - Main Entry
Size limit:   80 kB
Size:         71.36 kB with all dependencies, minified and gzipped
Loading time: 1.4 s    on slow 3G
Running time: 402 ms   on Snapdragon 410
Total time:   1.8 s
@reown/appkit/react
Size limit:   230 kB
Size:         228.29 kB with all dependencies, minified and gzipped
Loading time: 4.5 s     on slow 3G
Running time: 783 ms    on Snapdragon 410
Total time:   5.3 s
@reown/appkit/vue
Size limit:   80 kB
Size:         71.36 kB with all dependencies, minified and gzipped
Loading time: 1.4 s    on slow 3G
Running time: 488 ms   on Snapdragon 410
Total time:   1.9 s
@reown/appkit-scaffold-ui
Size limit:   220 kB
Size:         209.39 kB with all dependencies, minified and gzipped
Loading time: 4.1 s     on slow 3G
Running time: 520 ms    on Snapdragon 410
Total time:   4.7 s
@reown/appkit-ui
Size limit:   500 kB
Size:         13.15 kB with all dependencies, minified and gzipped
Loading time: 257 ms   on slow 3G
Running time: 176 ms   on Snapdragon 410
Total time:   433 ms

@github-actions
Copy link
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 79.72% 38346 / 48098
🔵 Statements 79.72% 38346 / 48098
🔵 Functions 77.3% 4107 / 5313
🔵 Branches 86.63% 9305 / 10741
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/scaffold-ui/src/modal/w3m-modal/index.ts 87.87% 87.27% 100% 87.87% 81-84, 98-99, 109-110, 132, 160, 166-167, 209, 227-235, 279-280
Generated in workflow #16416 for commit a53ce1f by the Vitest Coverage Report Action

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