Skip to content

chore: add react export with context and provider#4703

Merged
tomiir merged 4 commits intomainfrom
feat/universal-connector-react
Jul 25, 2025
Merged

chore: add react export with context and provider#4703
tomiir merged 4 commits intomainfrom
feat/universal-connector-react

Conversation

@tomiir
Copy link
Copy Markdown
Collaborator

@tomiir tomiir commented Jul 24, 2025

Description

  • Adds /react export to universal-connector with a React context and provider serving the connector

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

Closes APKT-3375

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

@linear
Copy link
Copy Markdown

linear bot commented Jul 24, 2025

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jul 24, 2025

🦋 Changeset detected

Latest commit: eac5030

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

This PR includes changesets to release 24 packages
Name Type
@reown/appkit-universal-connector Patch
@reown/appkit Patch
@reown/appkit-adapter-bitcoin Patch
@reown/appkit-adapter-ethers Patch
@reown/appkit-adapter-ethers5 Patch
@reown/appkit-adapter-solana Patch
@reown/appkit-adapter-wagmi Patch
@reown/appkit-common Patch
@reown/appkit-ui Patch
@reown/appkit-controllers Patch
@reown/appkit-core Patch
@reown/appkit-utils Patch
@reown/appkit-scaffold-ui Patch
@reown/appkit-polyfills Patch
@reown/appkit-wallet Patch
@reown/appkit-siwe Patch
@reown/appkit-siwx Patch
@reown/appkit-wallet-button Patch
@reown/appkit-cdn Patch
@reown/appkit-experimental Patch
@reown/appkit-testing Patch
@reown/appkit-cli Patch
@reown/appkit-pay Patch
@reown/appkit-codemod 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
Copy Markdown

vercel bot commented Jul 24, 2025

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

Name Status Preview Comments Updated (UTC)
appkit-basic-html ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 25, 2025 8:21am
appkit-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 25, 2025 8:21am
appkit-gallery ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 25, 2025 8:21am
appkit-laboratory ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 25, 2025 8:21am
10 Skipped Deployments
Name Status Preview Comments Updated (UTC)
appkit-basic-example ⬜️ Ignored (Inspect) Jul 25, 2025 8:21am
appkit-basic-sign-client-example ⬜️ Ignored (Inspect) Jul 25, 2025 8:21am
appkit-basic-up-example ⬜️ Ignored (Inspect) Jul 25, 2025 8:21am
appkit-ethers5-bera ⬜️ Ignored (Inspect) Jul 25, 2025 8:21am
appkit-nansen-demo ⬜️ Ignored (Inspect) Jul 25, 2025 8:21am
appkit-vue-solana ⬜️ Ignored (Inspect) Jul 25, 2025 8:21am
appkit-wagmi-cdn-example ⬜️ Ignored (Inspect) Jul 25, 2025 8:21am
ethereum-provider-wagmi-example ⬜️ Ignored (Inspect) Jul 25, 2025 8:21am
next-wagmi-solana-bitcoin-example ⬜️ Ignored (Inspect) Jul 25, 2025 8:21am
vue-wagmi-example ⬜️ Ignored (Inspect) Jul 25, 2025 8:21am

memoizeCreateUniversalConnector(props)
.then(setConnector)
.then(() => setIsReady(true))
}, [props])
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: UniversalConnectorProvider: Unnecessary Re-renders and Error Handling

The useEffect in UniversalConnectorProvider uses [props] as a dependency. Due to ...props destructuring, props is a new object reference on every render, causing the effect to run unnecessarily and potentially re-initialize the UniversalConnector. Additionally, the useEffect lacks error handling for the memoizeCreateUniversalConnector promise. If initialization fails, the component will remain in a perpetual loading state (isReady stays false) without error indication or recovery.

Locations (1)

Fix in CursorFix in Web

}

return universalConnector
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: Memoization Ignores Config Changes

The memoizeCreateUniversalConnector function uses a global cache and only initializes the connector once, ignoring subsequent config changes. Consequently, if called with different configurations (e.g., from multiple UniversalConnectorProvider instances or updated props), it returns the connector initialized with the first config, leading to outdated or incorrect configuration.

Locations (1)

Fix in CursorFix in Web

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jul 24, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 77.57% 31781 / 40968
🔵 Statements 77.57% 31781 / 40968
🔵 Functions 69% 2623 / 3801
🔵 Branches 84.39% 6694 / 7932
File CoverageNo changed files found.
Generated in workflow #13763 for commit eac5030 by the Vitest Coverage Report Action

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
🔵 In progress
View logs
pay-test-exchange c4563c6 Jul 25 2025, 08:16 AM

@tomiir tomiir merged commit 3ad29e2 into main Jul 25, 2025
59 of 60 checks passed
@tomiir tomiir deleted the feat/universal-connector-react branch July 25, 2025 09:19
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