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

refactor: send statusChange event to sync wagmi status with account controller #3329

Merged
merged 25 commits into from
Nov 26, 2024

Conversation

enesozturk
Copy link
Contributor

@enesozturk enesozturk commented Nov 25, 2024

Description

We are exposing status value from useAppKitAccount hook and this status value is not working stable across different adapters.

We've tried using the watchAccount from Wagmi to keep our state sync with Wagmi's internal state. This has several problems;

  • We are initializing the adapters after Wagmi config and listeners are initialized. Due to this we cannot go very sync with Wagmi's internal state.
  • When we use watchAccount from Wagmi, since the other adapters don't have such listener, we should eventually update status manually depending on the connection status.

Current problem with this PR's approach:

  • The SSR support is not working perfectly. There are still things to improve on the SSR use cases.

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-xxx
For GH issues: closes #...

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

Copy link

changeset-bot bot commented Nov 25, 2024

🦋 Changeset detected

Latest commit: 575190f

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

This PR includes changesets to release 16 packages
Name Type
@reown/appkit-adapter-wagmi Patch
@reown/appkit Patch
@reown/appkit-common Patch
@reown/appkit-core Patch
@reown/appkit-adapter-ethers Patch
@reown/appkit-adapter-ethers5 Patch
@reown/appkit-adapter-solana Patch
@reown/appkit-utils Patch
@reown/appkit-cdn Patch
@reown/appkit-experimental Patch
@reown/appkit-polyfills Patch
@reown/appkit-scaffold-ui Patch
@reown/appkit-siwe Patch
@reown/appkit-siwx Patch
@reown/appkit-ui Patch
@reown/appkit-wallet 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

Copy link

vercel bot commented Nov 25, 2024

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

Name Status Preview Comments Updated (UTC)
appkit-gallery-new ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 26, 2024 0:16am
appkit-laboratory ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 26, 2024 0:16am
appkit-laboratory-new ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 26, 2024 0:16am
appkit-vue-solana ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 26, 2024 0:16am
appkit-wagmi-cdn-example ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 26, 2024 0:16am
vue-wagmi-example ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 26, 2024 0:16am

Copy link
Contributor

github-actions bot commented Nov 25, 2024

Coverage Report for Coverage

Status Category Percentage Covered / Total
🔵 Lines 400.75999999999993% 5319 / 24146
🔵 Statements 400.75999999999993% 5319 / 24146
🔵 Functions 413.33% 408 / 1477
🔵 Branches 559.6400000000001% 802 / 1792
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/appkit/exports/constants.ts 0% 0% 0% 0% 1
packages/appkit/src/client.ts 50.6% 72.67% 71.31% 50.6% 190-191, 234-235, 238-239, 254-257, 260-263, 266-267, 296-307, 310-319, 415, 419, 426, 464-467, 473-480, 483, 571-583, 602-605, 612-613, 621-622, 637-638, 641-642, 645-646, 649-650, 659-669, 675-682, 699-702, 711-740, 742-779, 781-785, 807-812, 814-822, 824-833, 835-855, 857-864, 866-877, 879-892, 894-897, 899-902, 904-907, 909-912, 914-921, 926-987, 990-1003, 1011-1012, 1020-1021, 1025-1123, 1126-1138, 1144-1147, 1151-1181, 1191, 1197-1212, 1216-1218, 1222-1237, 1242-1252, 1255-1333, 1336-1350, 1377, 1394, 1423-1429, 1431-1442, 1444-1451, 1473-1489, 1504-1508, 1523, 1537, 1539-1540, 1578, 1580-1581, 1587-1598, 1605-1606, 1616, 1618, 1699, 1716-1720
packages/appkit/src/adapters/ChainAdapterBlueprint.ts 22.34% 66.66% 18.18% 22.34% 56-57, 65-68, 83-84, 91-100, 107-116, 123-155, 158-159, 168-173, 182-186, 195-199
packages/common/src/utils/SafeLocalStorage.ts 91.11% 100% 80% 91.11% 59-62
packages/core/src/controllers/ConnectionController.ts 43.82% 66.66% 28% 43.82% 86-90, 104-134, 152-154, 157-173, 176-177, 180-181, 184-185, 188-189, 192-193, 196-197, 200-201, 204-205, 208-209, 212-213, 230-231, 234-236, 239-240, 243-244, 247-248, 256-262, 268-269
packages/core/src/utils/StorageUtil.ts 62.8% 74.07% 71.42% 62.8% 49-50, 59-62, 69-70, 74-79, 85-88, 95-96, 103-106, 113-116, 120-129, 132-137, 140-145
packages/core/src/utils/TypeUtil.ts 100% 100% 100% 100%
Generated in workflow #7624 for commit 575190f 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.

2 participants