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: refreshing when connected to multiple namespaces only reconnects active namespace #3440

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

tomiir
Copy link
Collaborator

@tomiir tomiir commented Dec 11, 2024

Description

Currently if user is connected to multiple namespaces and refreshes the page, only the last connected connection is re-initialized.

  • Modifies storage to hold a reference to the connected connector PER NAMESPACE
  • For every namespace configured, checks storage and re-initializes connection

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-1593

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

linear bot commented Dec 11, 2024

Copy link

changeset-bot bot commented Dec 11, 2024

🦋 Changeset detected

Latest commit: 4897b16

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

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

Copy link

vercel bot commented Dec 11, 2024

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

Name Status Preview Comments Updated (UTC)
appkit-builder ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 17, 2024 5:19am
appkit-laboratory ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 17, 2024 5:19am
appkit-vue-solana ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 17, 2024 5:19am
appkit-wagmi-cdn-example ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 17, 2024 5:19am
vue-wagmi-example ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 17, 2024 5:19am

Copy link
Contributor

github-actions bot commented Dec 11, 2024

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 57.26% 15823 / 27632
🔵 Statements 57.26% 15823 / 27632
🔵 Functions 44.91% 1176 / 2618
🔵 Branches 77.02% 2243 / 2912
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/appkit/src/client.ts 18.81% 100% 0% 18.81% 188-195, 198-199, 202-237, 241-243, 246-248, 251-252, 256-257, 260-261, 264-273, 276-279, 282-285, 288-289, 292-293, 296-297, 300-302, 305-306, 309-310, 313-315, 318-319, 322-323, 326-337, 340-349, 352-353, 356-357, 360-361, 364-365, 368-369, 372-373, 376-377, 380-381, 384-385, 388-389, 392-393, 396-397, 400-401, 404-405, 408-411, 616-617, 620-623, 626-627, 630-631, 634-635, 638-639, 642-643, 647-734, 737-748, 751-771, 774-780, 783-792, 795-1128, 1131-1132, 1135-1268, 1271-1311, 1314-1382, 1385-1394, 1397-1407, 1410-1489, 1492-1512, 1515-1531, 1534-1559, 1565-1586, 1589-1628, 1631-1674, 1677-1688, 1691-1703, 1709-1738, 1741-1762, 1765-1766, 1769-1778, 1781-1798, 1801-1821, 1824-1833, 1836-1852, 1855-1905, 1908-1919, 1922-1932, 1935-1951
packages/common/src/utils/SafeLocalStorage.ts 100% 100% 100% 100%
packages/core/src/controllers/ChainController.ts 85.21% 82.24% 76.11% 85.21% 74, 81, 89, 93-101, 158-159, 201-208, 213-214, 221, 239-240, 244-251, 284-286, 295-296, 299-300, 309-310, 315-316, 332-333, 385-392, 400, 434-440, 473-475, 499-500, 558
packages/core/src/controllers/ConnectionController.ts 60.24% 81.25% 32.65% 60.24% 88, 107-137, 155-157, 161-176, 180, 184, 188, 192, 196, 200, 204, 208, 212, 216, 238-239, 247, 251, 259-260, 111
packages/core/src/controllers/SwapController.ts 47.54% 62.85% 56.89% 47.54% 40-43, 166, 170, 178-179, 182-183, 190-191, 221-226, 252, 259-261, 270-271, 279-293, 297-309, 321, 325, 330-331, 339-342, 375, 382, 387-405, 415-417, 430-431, 442-443, 455, 462-463, 467-475, 503-504, 526-527, 541, 550-588, 592-649, 653-703, 708-760, 764-849, 866, 479-485, 865
packages/core/src/utils/CoreHelperUtil.ts 65.78% 82.27% 51.35% 65.78% 19, 23, 39, 43, 47, 58-59, 67, 90-91, 102-103, 110-111, 115-116, 126-138, 143-144, 153-157, 173-181, 201-216, 236-241, 249-254, 273, 275, 277-278, 288-293, 297-300, 310, 315, 320, 330-331, 339-348, 351-359, 114, 373
packages/core/src/utils/SIWXUtil.ts 10.96% 75% 17.64% 10.96% 23-59, 62-137, 140-151, 154-162, 165-176, 179-270, 273-278, 284-285, 46-262
packages/core/src/utils/StorageUtil.ts 72% 87.27% 82.05% 72% 59-60, 76-79, 83-87, 102-103, 112-115, 125-126, 135-138, 147-150, 157-158, 165-166, 173-176, 183-186, 190-195, 199-203, 207-212
packages/scaffold-ui/src/partials/w3m-account-auth-button/index.ts 92.3% 83.33% 80% 92.3% 27, 63, 76-77
packages/scaffold-ui/src/partials/w3m-account-default-widget/index.ts 69.37% 74.5% 62.5% 69.37% 61-62, 70, 74-80, 87-88, 129, 151, 167, 185, 205, 225, 231-232, 248, 252-253, 256-257, 264-265, 271-272, 280, 301-305, 315, 320-321, 326-327, 334-335, 341, 345-376, 390-400, 409-410, 417-422, 425-427, 397
packages/scaffold-ui/src/utils/w3m-connecting-widget/index.ts 62.69% 23.8% 55.55% 62.69% 68-72, 80-81, 90-92, 100, 106-107, 110-111, 146-155, 173, 179-185, 189-198, 209-217
packages/scaffold-ui/src/views/w3m-account-settings-view/index.ts 85.18% 85.41% 81.25% 85.18% 53-60, 67-69, 76-77, 82-83, 150, 177, 199, 237, 254, 258-259, 267, 272-273, 281, 302-303
packages/scaffold-ui/src/views/w3m-account-view/index.ts 88.57% 100% 66.66% 88.57% 19, 25-26, 41
packages/scaffold-ui/src/views/w3m-buy-in-progress-view/index.ts 86.86% 79.41% 84.61% 86.86% 51, 59-62, 128, 134-135, 143, 157-158, 181-182, 187-188, 200-201, 206
packages/scaffold-ui/src/views/w3m-connecting-farcaster-view/index.ts 18.29% 100% 0% 18.29% 40-58, 61-64, 68-71, 75-80, 83-88, 91-104, 107-137, 140-169, 172-176, 179-215, 218-230, 233-239, 242-256, 259-270, 278-286
packages/scaffold-ui/src/views/w3m-network-switch-view/index.ts 89.74% 86.2% 88.88% 89.74% 99, 105-106, 121-122, 137-139
packages/scaffold-ui/src/views/w3m-networks-view/index.ts 95.49% 88.46% 80% 95.49% 42-43, 69, 84, 128
packages/scaffold-ui/src/views/w3m-profile-view/index.ts 17.64% 100% 0% 17.64% 39-59, 62-63, 67-118, 122-130, 133-142, 145-158, 161-172
packages/scaffold-ui/src/views/w3m-switch-address-view/index.ts 92.47% 86.95% 100% 92.47% 47, 50-53, 94, 153
packages/scaffold-ui/src/views/w3m-wallet-receive-view/index.ts 16.66% 100% 0% 16.66% 34-53, 56-57, 61-106, 110-138, 141-142, 145-153
packages/ui/src/composites/wui-list-account/index.ts 22.98% 100% 0% 22.98% 49-66, 69-84, 88-132, 137-151
packages/ui/src/composites/wui-profile-button-v2/index.ts 73.21% 28.57% 50% 73.21% 51-55, 86-92, 96-104
Generated in workflow #8161 for commit 4897b16 by the Vitest Coverage Report Action

@tomiir tomiir changed the title Fix/multichain reconnect fix: reconnecting when connected to multiple namespaces only reconnects active namespace Dec 11, 2024
@tomiir tomiir changed the title fix: reconnecting when connected to multiple namespaces only reconnects active namespace fix: refreshing when connected to multiple namespaces only reconnects active namespace Dec 11, 2024
Copy link
Collaborator

@lukaisailovic lukaisailovic left a comment

Choose a reason for hiding this comment

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

@tomiir We're missing unit tests for the scaffold-ui package. We should assert the UI changes with their respective methods (getLabel, getSubLabel etc)

@tomiir
Copy link
Collaborator Author

tomiir commented Dec 13, 2024

@lukaisailovic tested this and all other behaviors on pages I modified, think this is the approach we should take from now on to complete the testing coverage. Like any file touched requires a complete testing file.

Copy link
Collaborator

@lukaisailovic lukaisailovic left a comment

Choose a reason for hiding this comment

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

Awesome😍

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