Skip to content

Conversation

MananTank
Copy link
Member

@MananTank MananTank commented Sep 29, 2025


PR-Codex overview

This PR focuses on improving the user experience in the SwapWidget by removing retries when fetching the list of tokens fails. This change aims to reduce the loading time for skeletons displayed in the UI.

Detailed summary

  • Updated use-tokens.ts to set retry: false when fetching tokens.
  • Ensured that retry: false is applied under refetchOnMount and refetchOnWindowFocus.

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

Summary by CodeRabbit

  • Bug Fixes

    • Improved SwapWidget responsiveness by stopping automatic retrying when fetching token lists and balances. Loading placeholders now disappear sooner and errors surface faster so users can act without long waits.
  • Chores

    • Added a changelog entry documenting this behavior change.

Copy link

linear bot commented Sep 29, 2025

Copy link

vercel bot commented Sep 29, 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 Sep 29, 2025 7:22pm
nebula Ready Ready Preview Comment Sep 29, 2025 7:22pm
thirdweb_playground Ready Ready Preview Comment Sep 29, 2025 7:22pm
thirdweb-www Ready Ready Preview Comment Sep 29, 2025 7:22pm
wallet-ui Ready Ready Preview Comment Sep 29, 2025 7:22pm

Copy link

changeset-bot bot commented Sep 29, 2025

🦋 Changeset detected

Latest commit: b8afa98

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

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

@MananTank MananTank marked this pull request as ready for review September 29, 2025 14:48
@MananTank MananTank requested a review from a team as a code owner September 29, 2025 14:48
@github-actions github-actions bot added the SDK Involves changes to the thirdweb SDK label Sep 29, 2025
@MananTank MananTank requested a review from a team as a code owner September 29, 2025 14:48
Copy link
Contributor

coderabbitai bot commented Sep 29, 2025

Walkthrough

Removed automatic retries from two React Query hooks used by the SwapWidget token module and added a changeset entry documenting that retries when fetching token data were disabled.

Changes

Cohort / File(s) Summary
Swap widget token queries
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/use-tokens.ts
Added retry: false to two useQuery calls (token list fetch and token balances fetch). No other logic, signatures, or error messages changed.
Changeset metadata
.changeset/large-lizards-feel.md
New changeset documenting removal of retries when fetching the token list in SwapWidget.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant UI as SwapWidget UI
  participant Hooks as useTokens / useTokenBalances
  participant RQ as React Query
  participant API as Token Service

  UI->>Hooks: render()
  Hooks->>RQ: useQuery(..., retry: false)
  RQ->>API: fetch tokens / balances
  alt Success
    API-->>RQ: data
    RQ-->>Hooks: data (cached)
    Hooks-->>UI: render with data
  else Error
    API-->>RQ: error
    Note right of RQ #lightgrey: Automatic retries disabled
    RQ-->>Hooks: error state
    Hooks-->>UI: render error / stop skeleton
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description retains the intact template comments and only includes the PR-Codex overview without populating the required title, notes for the reviewer, or testing instructions sections as specified in the repository template. Please replace the template comments with the actual formatted title, add a “Notes for the reviewer” section describing important details, and provide a “How to test” section outlining specific test steps or environments.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title “[MNY-212] SDK: Set refetch: false on token list queries in SwapWidget” concisely and accurately describes the primary change by highlighting the disabling of retry behavior for SwapWidget token queries and includes the issue tag for context without extraneous details.
Linked Issues Check ✅ Passed The pull request disables automatic retry logic on both token list and token balance queries, directly addressing the errors reported when browsing tokens in the SwapWidget (MNY-212) by preventing redundant retry attempts from generating repeated errors.
Out of Scope Changes Check ✅ Passed The pull request only introduces a new changeset entry and disables retry behavior on the SwapWidget token and balance queries, with no modifications outside the scope of improving token fetch behavior.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch mny-212

📜 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 54392ab and b8afa98.

📒 Files selected for processing (2)
  • .changeset/large-lizards-feel.md (1 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/swap-widget/use-tokens.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • .changeset/large-lizards-feel.md
  • packages/thirdweb/src/react/web/ui/Bridge/swap-widget/use-tokens.ts
⏰ 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). (1)
  • GitHub Check: Analyze (javascript)

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.

Copy link
Member Author

MananTank commented Sep 29, 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.

@MananTank MananTank changed the title [MNY-212] SDK: Set on token list queries [MNY-212] SDK: Set refetch: false on token list queries in SwapWidget Sep 29, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 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 496615f and 54392ab.

📒 Files selected for processing (2)
  • .changeset/large-lizards-feel.md (1 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/swap-widget/use-tokens.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
.changeset/*.md

📄 CodeRabbit inference engine (AGENTS.md)

.changeset/*.md: Each change in packages/* must include a changeset for the appropriate package
Version bump rules: patch for non‑API changes; minor for new/modified public API

Files:

  • .changeset/large-lizards-feel.md
**/*.{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/swap-widget/use-tokens.ts
**/*.{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/swap-widget/use-tokens.ts
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/swap-widget/use-tokens.ts
🧠 Learnings (2)
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to apps/{dashboard,playground}/**/*.{ts,tsx} : Client-side data fetching: wrap calls in React Query with descriptive, stable `queryKeys` and set sensible `staleTime/cacheTime` (≥ 60s default); keep tokens secret via internal routes or server actions

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/swap-widget/use-tokens.ts
📚 Learning: 2025-09-24T11:08:43.783Z
Learnt from: MananTank
PR: thirdweb-dev/js#8106
File: packages/thirdweb/src/react/web/ui/Bridge/bridge-widget/bridge-widget.tsx:34-41
Timestamp: 2025-09-24T11:08:43.783Z
Learning: In BridgeWidgetProps for packages/thirdweb/src/react/web/ui/Bridge/bridge-widget/bridge-widget.tsx, the Swap onError callback signature requires a non-undefined SwapPreparedQuote parameter (unlike Buy's onError which allows undefined quote). This is intentional - SwapWidget's onError is only called when a quote is available.

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/swap-widget/use-tokens.ts
⏰ 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). (8)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Size
  • GitHub Check: Lint Packages
  • GitHub Check: Unit Tests
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript)

Copy link
Contributor

github-actions bot commented Sep 29, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 64.69 KB (0%) 1.3 s (0%) 421 ms (+116.41% 🔺) 1.8 s
thirdweb (cjs) 361.52 KB (0%) 7.3 s (0%) 1.8 s (+0.99% 🔺) 9 s
thirdweb (minimal + tree-shaking) 5.73 KB (0%) 115 ms (0%) 147 ms (+559.35% 🔺) 262 ms
thirdweb/chains (tree-shaking) 526 B (0%) 11 ms (0%) 38 ms (+378.28% 🔺) 48 ms
thirdweb/react (minimal + tree-shaking) 19.14 KB (0%) 383 ms (0%) 40 ms (+66.02% 🔺) 423 ms

Copy link

codecov bot commented Sep 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.28%. Comparing base (496615f) to head (b8afa98).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8144      +/-   ##
==========================================
- Coverage   56.29%   56.28%   -0.01%     
==========================================
  Files         906      906              
  Lines       59208    59208              
  Branches     4177     4177              
==========================================
- Hits        33329    33324       -5     
- Misses      25774    25779       +5     
  Partials      105      105              
Flag Coverage Δ
packages 56.28% <ø> (-0.01%) ⬇️
see 2 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.

Copy link
Contributor

graphite-app bot commented Sep 29, 2025

Merge activity

…et (#8144)

<!--

## 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 improving the loading experience in the `SwapWidget` by removing the retry mechanism when fetching the list of tokens, which reduces the time skeletons are displayed in the UI.

### Detailed summary
- Removed the `retry` option from the token fetching query in `use-tokens.ts`.
- The `retry` option is set to `false` for both the tokens query and the token balances query.
- This change aims to decrease loading times and improve UI responsiveness.

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

* **Bug Fixes**
  * Improved SwapWidget responsiveness by removing automatic retries for fetching token lists and balances, reducing how long loading placeholders are shown. Errors surface sooner, enabling quicker user action.

* **Chores**
  * Added a changelog entry documenting the update.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.

2 participants