Skip to content

Conversation

@MananTank
Copy link
Member

@MananTank MananTank commented Nov 5, 2025


PR-Codex overview

This PR focuses on fixing the BuyWidget component's auto-connect functionality, particularly when the receiverAddress prop is set. It adds support for auto-connect options and introduces a new story variant to demonstrate the feature.

Detailed summary

  • Added support for autoConnect option in the BuyWidget.
  • Updated the BuyWidget component to conditionally render the AutoConnect component based on connectOptions.
  • Introduced a new story NoAutoConnect to showcase the BuyWidget without auto-connect enabled.

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

Summary by CodeRabbit

  • Bug Fixes

    • Fixed auto-connect so it behaves correctly when a receiver address is set in the buy flow.
  • New Features

    • Added a configurable auto-connect option for the buy widget so users can enable or disable automatic wallet connection.
    • Connect buttons that opt out of auto-connect will no longer auto-connect.
  • Documentation

    • Added a story/example showing the buy widget with auto-connect disabled.

@linear
Copy link

linear bot commented Nov 5, 2025

@vercel
Copy link

vercel bot commented Nov 5, 2025

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

Project Deployment Preview Comments Updated (UTC)
docs-v2 Ready Ready Preview Comment Nov 5, 2025 9:18pm
nebula Ready Ready Preview Comment Nov 5, 2025 9:18pm
thirdweb_playground Ready Ready Preview Comment Nov 5, 2025 9:18pm
thirdweb-www Ready Ready Preview Comment Nov 5, 2025 9:18pm
wallet-ui Ready Ready Preview Comment Nov 5, 2025 9:18pm

@changeset-bot
Copy link

changeset-bot bot commented Nov 5, 2025

🦋 Changeset detected

Latest commit: d907017

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

This PR includes changesets to release 4 packages
Name Type
thirdweb Patch
@thirdweb-dev/nebula Patch
@thirdweb-dev/wagmi-adapter Patch
wagmi-inapp 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 Nov 5, 2025
@MananTank MananTank marked this pull request as ready for review November 5, 2025 20:57
@MananTank MananTank requested review from a team as code owners November 5, 2025 20:57
Copy link
Member Author


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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 5, 2025

Walkthrough

Adds conditional AutoConnect rendering to BuyWidget when connectOptions.autoConnect is enabled, sets autoConnect={false} on FundWallet's ConnectButton, adds a story demonstrating disabled autoconnect, and adds a patch changeset documenting the bug fix.

Changes

Cohort / File(s) Summary
Bug fix: AutoConnect integration
packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
Imports AutoConnect and conditionally renders it when connectOptions.autoConnect is not false; passes wallets, timeout (if object), appMetadata, accountAbstraction, and chain props.
Dependent update: Prevent duplicate autoconnect
packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
Adds autoConnect={false} prop to ConnectButton to disable auto-connection in that context.
Story: NoAutoConnect
packages/thirdweb/src/stories/BuyWidget.stories.tsx
Adds exported NoAutoConnect story that renders BuyWidget with connectOptions.autoConnect set to false.
Changelog
.changeset/bumpy-shoes-flow.md
Adds a patch-level changeset documenting the BuyWidget autoconnect fix.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant BuyWidget
    participant AutoConnect
    participant BridgeWidgetContent

    User->>BuyWidget: Render with receiverAddress & connectOptions
    activate BuyWidget
    alt connectOptions.autoConnect !== false
        BuyWidget->>AutoConnect: Render with wallets, timeout, appMetadata, accountAbstraction, chain
        activate AutoConnect
        AutoConnect->>AutoConnect: Attempt automatic connection
        AutoConnect-->>BuyWidget: Return connection status
        deactivate AutoConnect
    end
    BuyWidget->>BridgeWidgetContent: Render main bridge UI (connect button, content)
    BridgeWidgetContent->>User: Display UI / prompts
    deactivate BuyWidget
Loading

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify AutoConnect is rendered only when connectOptions.autoConnect is not false and receives the correct props (wallets, timeout, appMetadata, accountAbstraction, chain).
  • Confirm autoConnect={false} on ConnectButton in FundWallet prevents duplicate auto-connection.
  • Ensure the NoAutoConnect story renders and exercises the disabled-autoconnect path.

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description uses PR-Codex overview format instead of the required template. While it provides clear summaries, it lacks required sections like 'Notes for the reviewer' and 'How to test'. Follow the template structure with explicit sections for 'Notes for the reviewer' and 'How to test' to provide complete testing guidance and any important reviewer callouts.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically identifies the main change: fixing BuyWidget autoconnect when receiverAddress prop is set, with the issue reference MNY-295.
Linked Issues check ✅ Passed The PR successfully addresses MNY-295 by adding autoConnect support to BuyWidget and conditionally rendering AutoConnect based on connectOptions, restoring autoconnect functionality when receiverAddress prop is set.
Out of Scope Changes check ✅ Passed All changes (BuyWidget autoConnect logic, FundWallet autoConnect=false, and NoAutoConnect story) are directly related to fixing the autoconnect behavior when receiverAddress prop is set, with no unrelated modifications.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 11-06-_mny-295_fix_buywidget_autoconnect_not_working_when_receiveraddress_prop_is_set

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c5041b9 and d907017.

📒 Files selected for processing (4)
  • .changeset/bumpy-shoes-flow.md (1 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx (2 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (1 hunks)
  • packages/thirdweb/src/stories/BuyWidget.stories.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • .changeset/bumpy-shoes-flow.md
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

**/*.{ts,tsx}: Use explicit function declarations and explicit return types in TypeScript
Limit each file to one stateless, single‑responsibility function
Re‑use shared types from @/types where applicable
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Prefer composition over inheritance; use utility types (Partial, Pick, etc.)
Lazy‑import optional features and avoid top‑level side‑effects to reduce bundle size

Files:

  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
  • packages/thirdweb/src/stories/BuyWidget.stories.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
  • packages/thirdweb/src/stories/BuyWidget.stories.tsx
packages/thirdweb/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

packages/thirdweb/**/*.{ts,tsx}: Every public symbol must have comprehensive TSDoc with at least one compiling @example and a custom tag (@beta, @internal, @experimental, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose
Lazy‑load heavy dependencies inside async paths (e.g., const { jsPDF } = await import("jspdf"))

Files:

  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
  • packages/thirdweb/src/stories/BuyWidget.stories.tsx
**/*.stories.tsx

📄 CodeRabbit inference engine (CLAUDE.md)

For new UI components, add Storybook stories (*.stories.tsx) alongside the code

Files:

  • packages/thirdweb/src/stories/BuyWidget.stories.tsx
🧠 Learnings (6)
📚 Learning: 2025-09-23T19:56:43.668Z
Learnt from: MananTank
Repo: thirdweb-dev/js PR: 8106
File: packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx:482-485
Timestamp: 2025-09-23T19:56:43.668Z
Learning: In packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx, the EmbedContainer uses width: "100vw" intentionally rather than "100%" - this is by design for the bridge widget embedding use case.

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
📚 Learning: 2025-10-03T23:36:00.631Z
Learnt from: MananTank
Repo: thirdweb-dev/js PR: 8181
File: packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx:27-27
Timestamp: 2025-10-03T23:36:00.631Z
Learning: In packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx, the component intentionally uses a hardcoded English locale (connectLocaleEn) rather than reading from the provider, as BuyWidget is designed to be English-only and does not require internationalization support.

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
  • packages/thirdweb/src/stories/BuyWidget.stories.tsx
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Interactive UI that relies on hooks (`useState`, `useEffect`, React Query, wallet hooks).

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to apps/{dashboard,playground}/**/*.stories.tsx : Add Storybook stories (`*.stories.tsx`) alongside new UI components

Applied to files:

  • packages/thirdweb/src/stories/BuyWidget.stories.tsx
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to **/*.stories.tsx : For new UI components, add Storybook stories (`*.stories.tsx`) alongside the code

Applied to files:

  • packages/thirdweb/src/stories/BuyWidget.stories.tsx
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/components/*.{stories,test}.{tsx,ts} : Provide a Storybook story (`MyComponent.stories.tsx`) or unit test alongside the component.

Applied to files:

  • packages/thirdweb/src/stories/BuyWidget.stories.tsx
🧬 Code graph analysis (1)
packages/thirdweb/src/stories/BuyWidget.stories.tsx (2)
packages/thirdweb/src/stories/utils.tsx (1)
  • storyClient (14-16)
packages/thirdweb/src/exports/chains.ts (1)
  • ethereum (33-33)
🪛 Gitleaks (8.28.0)
packages/thirdweb/src/stories/BuyWidget.stories.tsx

[high] 146-146: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Size
  • GitHub Check: Unit Tests
  • GitHub Check: Build Packages
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (1)

289-302: LGTM! Correct delegation of autoconnect responsibility.

The explicit autoConnect={false} ensures that FundWallet's ConnectButton never auto-connects, delegating that responsibility to BuyWidget's AutoConnect component. This prevents conflicting autoconnect behavior and aligns with the PR objective of fixing autoconnect when receiverAddress is set.

The placement after the spread operator ({...props.connectOptions}) intentionally overrides any autoConnect value from connectOptions, ensuring consistent behavior.

packages/thirdweb/src/stories/BuyWidget.stories.tsx (1)

141-153: LGTM! Good story coverage for autoConnect behavior.

The NoAutoConnect story effectively demonstrates the autoConnect: false behavior, mirroring the LargeAmount story structure while adding the connectOptions configuration. This provides clear documentation and testing for the feature.

Note: The static analysis hint flagging line 146 is a false positive—0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984 is the public UNI token contract address, not a secret.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • TEAM-0000: Entity not found: Issue - Could not find referenced Issue.

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

size-limit report 📦

Path Size
@thirdweb-dev/nexus (esm) 104.88 KB (0%)
@thirdweb-dev/nexus (cjs) 316.6 KB (0%)

@codecov
Copy link

codecov bot commented Nov 5, 2025

Codecov Report

❌ Patch coverage is 7.14286% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.64%. Comparing base (cf53c2d) to head (d907017).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ges/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx 7.69% 12 Missing ⚠️
...es/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8363      +/-   ##
==========================================
- Coverage   54.65%   54.64%   -0.02%     
==========================================
  Files         919      919              
  Lines       60678    60692      +14     
  Branches     4109     4115       +6     
==========================================
  Hits        33164    33164              
- Misses      27412    27426      +14     
  Partials      102      102              
Flag Coverage Δ
packages 54.64% <7.14%> (-0.02%) ⬇️
Files with missing lines Coverage Δ
...es/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx 6.21% <0.00%> (-0.02%) ⬇️
...ges/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx 5.64% <7.69%> (+0.08%) ⬆️

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@graphite-app
Copy link
Contributor

graphite-app bot commented Nov 5, 2025

Merge activity

…prop is set (#8363)

<!--

## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes"

If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000):

## Notes for the reviewer

Anything important to call out? Be sure to also clarify these in your comments.

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on fixing the `BuyWidget` component's autoconnect functionality when the `receiverAddress` prop is set, and it introduces a new story variant to demonstrate this behavior.

### Detailed summary
- Updated `BuyWidget` to conditionally render the `AutoConnect` component based on `connectOptions.autoConnect`.
- Introduced a new story `NoAutoConnect` in `BuyWidget.stories.tsx` to showcase the widget with `autoConnect` set to false.
- Modified `FundWallet.tsx` to ensure proper handling of the `autoConnect` prop.

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

<!-- end pr-codex -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

## Release Notes

* **Bug Fixes**
  * Fixed auto-connect functionality that was not working correctly when the receiver address property is set on the buy widget.

* **New Features**
  * Added configurable auto-connect option to the buy widget, enabling users to control whether auto-connection is enabled or disabled based on their needs.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@graphite-app graphite-app bot force-pushed the 11-06-_mny-295_fix_buywidget_autoconnect_not_working_when_receiveraddress_prop_is_set branch from c5041b9 to d907017 Compare November 5, 2025 21:10
@graphite-app graphite-app bot merged commit d907017 into main Nov 5, 2025
23 of 24 checks passed
@graphite-app graphite-app bot deleted the 11-06-_mny-295_fix_buywidget_autoconnect_not_working_when_receiveraddress_prop_is_set branch November 5, 2025 21:18
@joaquim-verges joaquim-verges mentioned this pull request Nov 5, 2025
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