Skip to content

Conversation

@kien-ngo
Copy link
Contributor

@kien-ngo kien-ngo commented Jan 3, 2025

TOOL-2673


PR-Codex overview

This PR introduces an onTimeout callback to the useAutoConnect functionality in the thirdweb package, enhancing connection management. Additionally, it adds tests for the getUrlToken function and updates the vitest configuration for testing.

Detailed summary

  • Added onTimeout callback to useAutoConnect.
  • Updated types.ts to include onTimeout in the connection options.
  • Modified useAutoConnectCore to handle timeout scenarios.
  • Added tests for getUrlToken covering various cases.
  • Adjusted vitest.config.ts to include all test files.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@vercel
Copy link

vercel bot commented Jan 3, 2025

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

Name Status Preview Comments Updated (UTC)
docs-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 5, 2025 10:08pm
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 5, 2025 10:08pm
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 5, 2025 10:08pm
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 5, 2025 10:08pm

@changeset-bot
Copy link

changeset-bot bot commented Jan 3, 2025

🦋 Changeset detected

Latest commit: 810f319

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

This PR includes changesets to release 2 packages
Name Type
thirdweb Patch
@thirdweb-dev/wagmi-adapter 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

@github-actions github-actions bot added packages SDK Involves changes to the thirdweb SDK labels Jan 3, 2025
Copy link
Contributor Author

kien-ngo commented Jan 3, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@kien-ngo kien-ngo changed the title update onTimeout for useAutoConnect Jan 3, 2025
@kien-ngo kien-ngo marked this pull request as ready for review January 3, 2025 15:43
@kien-ngo kien-ngo requested review from a team as code owners January 3, 2025 15:43
@kien-ngo kien-ngo force-pushed the kien/useAutoConnect-throw-error-CNCT-2673 branch from ead15bb to b4a8832 Compare January 3, 2025 15:44
@github-actions
Copy link
Contributor

github-actions bot commented Jan 3, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 45 KB (0%) 900 ms (0%) 363 ms (+31.38% 🔺) 1.3 s
thirdweb (cjs) 110.81 KB (0%) 2.3 s (0%) 480 ms (-3.09% 🔽) 2.7 s
thirdweb (minimal + tree-shaking) 5.58 KB (0%) 112 ms (0%) 92 ms (+114.62% 🔺) 203 ms
thirdweb/chains (tree-shaking) 506 B (0%) 10 ms (0%) 26 ms (+604.19% 🔺) 36 ms
thirdweb/react (minimal + tree-shaking) 19.13 KB (0%) 383 ms (0%) 110 ms (+72.99% 🔺) 493 ms

@codecov
Copy link

codecov bot commented Jan 3, 2025

Codecov Report

Attention: Patch coverage is 80.00000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 55.27%. Comparing base (2a9d996) to head (810f319).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...web/src/react/core/hooks/wallets/useAutoConnect.ts 80.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5879      +/-   ##
==========================================
+ Coverage   55.19%   55.27%   +0.07%     
==========================================
  Files        1123     1123              
  Lines       59617    59636      +19     
  Branches     5028     5041      +13     
==========================================
+ Hits        32905    32961      +56     
+ Misses      25992    25953      -39     
- Partials      720      722       +2     
Flag Coverage Δ *Carryforward flag
legacy_packages 65.68% <ø> (ø) Carriedforward from 2a9d996
packages 52.94% <80.00%> (+0.09%) ⬆️

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
...web/src/react/core/hooks/wallets/useAutoConnect.ts 58.64% <80.00%> (+17.41%) ⬆️

... and 6 files with indirect coverage changes

@kien-ngo kien-ngo requested a review from gregfromstl January 3, 2025 15:55
@kien-ngo kien-ngo changed the title onTimeout for useAutoConnect [SDK] onTimeout for useAutoConnect Jan 3, 2025
@kien-ngo kien-ngo force-pushed the kien/useAutoConnect-throw-error-CNCT-2673 branch from b4a8832 to ac8ba1b Compare January 3, 2025 16:00
@kien-ngo kien-ngo changed the title [SDK] onTimeout for useAutoConnect [SDK] onTimeout for useAutoConnect | TOOL-2673 Jan 3, 2025
@linear
Copy link

linear bot commented Jan 3, 2025

Copy link
Contributor

@gregfromstl gregfromstl left a comment

Choose a reason for hiding this comment

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

Missing test coverage

@kien-ngo
Copy link
Contributor Author

kien-ngo commented Jan 5, 2025

/release-pr

@graphite-app
Copy link
Contributor

graphite-app bot commented Jan 5, 2025

Merge activity

TOOL-2673

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces an `onTimeout` callback to the `useAutoConnect` hook, enhancing its functionality by allowing users to define custom behavior when a connection attempt times out. It also includes tests for the new feature and refactors some wallet connection logic.

### Detailed summary
- Added `onTimeout` callback to `useAutoConnect`.
- Updated `useAutoConnectCore` to handle wallet connections with the new `onTimeout` feature.
- Refactored `handleWalletConnection` function to improve clarity.
- Added unit tests for `getUrlToken` covering various scenarios.
- Updated test configurations for better matching of test files.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packages SDK Involves changes to the thirdweb SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants