-
Notifications
You must be signed in to change notification settings - Fork 629
[SDK] Skip swap review step when coming from swap widget #8496
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
[SDK] Skip swap review step when coming from swap widget #8496
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: c73b607 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
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 |
WalkthroughThe changeset removes the payment review/preview screen from the swap widget's user flow, enabling direct navigation from the swap UI to the execution stage. Associated error handling callbacks and payment tracking for the preview step are eliminated. A changeset entry documents this adjustment. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~18 minutes
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
Comment |
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx (1)
146-153:onErrorcallback anderrorscreen are unreachable in current implementation
SwapWidgetProps.onError(line 153) is declared but never invoked. TheStepRunnercomponent (lines 403–432) is instantiated without anonErrorhandler—onlyonBack,onCancel, andonCompleteare passed. Nothing callssetScreen({ id: "error", ... }), leaving theErrorBannerbranch (lines 456–470) and theerrorscreen state variant (line 317) as dead code.If a swap fails during execution, no error callback fires and no error UI displays, breaking documented error-handling behavior for integrators.
Pass an
onErrorhandler toStepRunnerthat invokesprops.onError?.(error, screen.preparedQuote)and sets the screen to{ id: "error", error, preparedQuote: screen.preparedQuote }.
🧹 Nitpick comments (2)
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx (2)
367-401: Direct jump fromSwapUIto3:executematches “skip review” flow; consider analytics coverageLine 389 changes the
onSwaphandler to setid: "3:execute"directly, which aligns with the goal of skipping the review/preview step when coming from the swap widget. If you still need a signal for “user confirmed swap” distinct from execution, consider adding a replacement tracking event here since the previous preview-level tracking was removed.
304-307: Remove2:previewfromSwapWidgetScreenunion to reflect new flowThe
SwapWidgetScreentype (Lines 304-307) still includes the"2:preview"variant even though the preview UI and transitions have been removed, and no remaining code sets or checks for that state. Dropping this variant would keep the type aligned with the actual state machine and avoid confusion for future maintainers.For example:
type SwapWidgetScreen = - | { id: "1:swap-ui" } - | Join<{ id: "2:preview" }, SelectionInfo> - | Join<{ id: "3:execute" }, SelectionInfo> + | { id: "1:swap-ui" } + | Join<{ id: "3:execute" }, SelectionInfo>
📜 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.
📒 Files selected for processing (2)
.changeset/floppy-carrots-own.md(1 hunks)packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx(3 hunks)
🧰 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 TypeScript file to one stateless, single-responsibility function for clarity
Re-use shared types from@/typesor localtypes.tsbarrels
Prefer type aliases over interface except for nominal shapes in TypeScript
Avoidanyandunknownin TypeScript unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial,Pick, etc.) in TypeScript
**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity and testability
Re-use shared types from @/types or local types.ts barrel exports
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics whenever possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic in TypeScript files; avoid restating TypeScript types and signatures in prose
Files:
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx
packages/thirdweb/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
packages/thirdweb/src/**/*.{ts,tsx}: Comment only ambiguous logic in SDK code; avoid restating TypeScript in prose
Load heavy dependencies inside async paths to keep initial bundle lean (e.g.const { jsPDF } = await import("jspdf");)Lazy-load heavy dependencies inside async paths to keep the initial bundle lean (e.g., const { jsPDF } = await import('jspdf');)
Files:
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx
**/*.{js,jsx,ts,tsx,json}
📄 CodeRabbit inference engine (AGENTS.md)
Biome governs formatting and linting; its rules live in biome.json. Run
pnpm fix&pnpm lintbefore committing, ensure there are no linting errors
Files:
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Lazy-import optional features; avoid top-level side-effects
Files:
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx
⏰ 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). (9)
- GitHub Check: Vercel Agent Review
- GitHub Check: E2E Tests (pnpm, esbuild)
- GitHub Check: E2E Tests (pnpm, vite)
- GitHub Check: E2E Tests (pnpm, webpack)
- GitHub Check: Size
- GitHub Check: Unit Tests
- GitHub Check: Lint Packages
- GitHub Check: Build Packages
- GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
.changeset/floppy-carrots-own.md (1)
1-5: Changeset format and message are clear.The YAML frontmatter and description follow the standard Changesets convention. The message accurately reflects the PR objective of skipping the swap review step.
Please confirm that the
patchversion bump is appropriate given the removal of thehandleErrorfunction and changes to the swap widget flow. IfhandleErroris part of a public API contract, this may warrant aminorversion bump instead.packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx (1)
3-3: Import list correctly trimmed to used hooksLine 3 now only imports
useEffect,useRef, anduseState, which matches actual usage in this file and avoids unused-import lint noise.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8496 +/- ##
==========================================
- Coverage 54.63% 54.62% -0.01%
==========================================
Files 920 920
Lines 61142 61142
Branches 4145 4140 -5
==========================================
- Hits 33402 33397 -5
- Misses 27638 27643 +5
Partials 102 102
🚀 New features to boost your workflow:
|
size-limit report 📦
|

PR-Codex overview
This PR focuses on modifying the
SwapWidgetcomponent by skipping the swap review step when coming from the swap widget, streamlining the user experience during token swaps.Detailed summary
handleErrorfunction and its usage.PaymentDetailscomponent in the swap process."2:preview"to"3:execute"directly."1:swap-ui".Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.