-
Notifications
You must be signed in to change notification settings - Fork 620
[MNY-232] SDK: Fix ExecutingTxScreen missing back button in TransactionWidget #8193
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
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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. |
WalkthroughAdds a back-navigation handler to the executing-transaction UI by wiring an Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor U as User
participant ETS as ExecutingTxScreen
participant TW as TransactionWidget
note over ETS,TW: Execute-tx -> init-ui back path added
U->>ETS: Click Back
ETS->>TW: onBack()
TW->>TW: set screen = "init-ui"
TW-->>U: show init UI
sequenceDiagram
autonumber
actor U as User
participant ETS as ExecutingTxScreen
participant TM as TransactionModal
note over ETS,TM: Execute-tx -> deposit back path added
U->>ETS: Click Back
ETS->>TM: onBack()
TM->>TM: set screen = "deposit"
TM-->>U: show deposit UI
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used📓 Path-based instructions (3)**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
packages/thirdweb/**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
⏰ 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). (7)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
Comment |
size-limit report 📦
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8193 +/- ##
==========================================
- Coverage 55.04% 55.04% -0.01%
==========================================
Files 919 919
Lines 60563 60569 +6
Branches 4125 4127 +2
==========================================
Hits 33338 33338
- Misses 27121 27127 +6
Partials 104 104
🚀 New features to boost your workflow:
|
…onWidget (#8193) <!-- ## 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 enhancing the transaction handling in the `TransactionWidget` and `TransactionModal` components by ensuring that the `onBack` function is defined and properly utilized. ### Detailed summary - In `TransactionWidget.tsx`, added `onBack` function to `ExecutingTxScreen` that sets the screen to `init-ui`. - In `TransactionModal.tsx`, modified `onBack` to set the screen to `"deposit"`. - In `ExecutingScreen.tsx`, changed `onBack` from optional to required. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
3050e12 to
e911a66
Compare
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: 2
🧹 Nitpick comments (1)
packages/thirdweb/src/react/web/ui/TransactionButton/ExecutingScreen.tsx (1)
66-66: Avoid back during in-flight send; limit back to failure stateAllowing back while “loading” can unmount mid-send, leading to async setState on an unmounted component and confusing UX. Show the back button only on failure (as per MNY‑232 intent).
Apply:
- <ModalHeader onBack={props.onBack} title="Transaction" /> + <ModalHeader + onBack={status === "failed" ? props.onBack : undefined} + title="Transaction" + />Alternative: keep back always visible but add an isMounted guard to prevent setState after unmount. Happy to provide that patch if preferred.
📜 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 (3)
packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx(1 hunks)packages/thirdweb/src/react/web/ui/TransactionButton/ExecutingScreen.tsx(1 hunks)packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{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@/typesor localtypes.tsbarrels
Prefer type aliases over interface except for nominal shapes
Avoidanyandunknownunless 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@/typeswhere applicable
Prefertypealiases overinterfaceexcept for nominal shapes
Avoidanyandunknownunless 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/TransactionButton/TransactionModal.tsxpackages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsxpackages/thirdweb/src/react/web/ui/TransactionButton/ExecutingScreen.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/TransactionButton/TransactionModal.tsxpackages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsxpackages/thirdweb/src/react/web/ui/TransactionButton/ExecutingScreen.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@exampleand 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/TransactionButton/TransactionModal.tsxpackages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsxpackages/thirdweb/src/react/web/ui/TransactionButton/ExecutingScreen.tsx
🪛 GitHub Check: codecov/patch
packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx
[warning] 136-138: packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx#L136-L138
Added lines #L136 - L138 were not covered by tests
packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
[warning] 773-775: packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx#L773-L775
Added lines #L773 - L775 were not covered by tests
⏰ 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). (2)
- GitHub Check: Size
- GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
packages/thirdweb/src/react/web/ui/TransactionButton/ExecutingScreen.tsx (1)
23-23: Prop type tightening is safe – all callers pass onBack
Verified both TransactionModal.tsx and TransactionWidget.tsx pass an onBack prop to ExecutingTxScreen; no breaking changes.
| onBack={() => { | ||
| setScreen({ id: "init-ui" }); | ||
| }} |
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.
🛠️ Refactor suggestion | 🟠 Major
🧩 Analysis chain
LGTM: back action to init-ui; add coverage
Passing onBack to reset to "init-ui" is correct for recovery. Please add a test asserting the back button sets the screen back from "execute-tx".
Quick grep to help find all call sites to cover:
🏁 Script executed:
#!/bin/bash
rg -nP -C2 '<ExecutingTxScreen\b' Length of output: 997
Add tests for back action in ExecutingTxScreen
Add tests verifying that clicking the back button in <ExecutingTxScreen>
– in TransactionModal it resets the screen to "deposit",
– in TransactionWidget it resets the screen to { id: "init-ui" }.
🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 773-775: packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx#L773-L775
Added lines #L773 - L775 were not covered by tests
🤖 Prompt for AI Agents
In packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx around lines
773-775, the review requests tests for the back action: add unit tests that
render ExecutingTxScreen inside both TransactionModal and TransactionWidget,
simulate clicking the back button, and assert the resulting screen state;
specifically, in TransactionModal the screen should reset to the string
"deposit", and in TransactionWidget the screen should reset to an object { id:
"init-ui" }. Implement tests that (1) mount or render each parent component with
a controlled screen state or mock state setter, (2) find and click the back
button in ExecutingTxScreen, and (3) assert the screen setter was called with
the expected value ("deposit" for TransactionModal, { id: "init-ui" } for
TransactionWidget), using your test utilities/mocks consistent with the repo
testing patterns.
| onBack={() => { | ||
| setScreen("deposit"); | ||
| }} |
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.
🛠️ Refactor suggestion | 🟠 Major
🧩 Analysis chain
LGTM: back action wired for deposit flow; add a test
Wiring onBack to return to "deposit" looks correct. Please add a simple state-transition test to cover this path.
Example check:
🏁 Script executed:
#!/bin/bash
# List usages to guide adding tests for back navigation in deposit modal
rg -nP -C2 '<ExecutingTxScreen\b' packages/thirdweb/src/react/web/uiLength of output: 997
Add state-transition test for back action
Add a unit test in packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.test.tsx that mounts TransactionModal, navigates to "execute-tx", invokes the onBack callback on ExecutingTxScreen, and asserts that screen resets to "deposit".
🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 136-138: packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx#L136-L138
Added lines #L136 - L138 were not covered by tests
Merge activity
|
…onWidget (#8193) <!-- ## 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 updating the `onBack` functionality in the `TransactionWidget` and `TransactionModal` components, ensuring that the back navigation behavior is more consistent across these components. ### Detailed summary - In `TransactionWidget.tsx`, `onBack` now sets the screen to `init-ui`. - In `TransactionModal.tsx`, `onBack` sets the screen to `deposit`. - In `ExecutingScreen.tsx`, the `onBack` prop is changed from optional to required. > ✨ 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 * **New Features** * Added back navigation from the executing transaction screen, allowing users to return to the previous step without closing the modal. * Unified back-button behavior across transaction flows for a more consistent experience. * Provides clearer control during long-running executions with an explicit back option. * Navigation enhancement applies to both bridge and transaction modal flows, improving step-to-step control while keeping transaction processing unchanged. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
e911a66 to
68b48f4
Compare

PR-Codex overview
This PR focuses on enhancing the
onBackfunctionality in theExecutingTxScreencomponent across different files, allowing for better navigation management in transaction workflows.Detailed summary
TransactionWidget.tsx,onBackis updated to set the screen to"init-ui".TransactionModal.tsx,onBacknow sets the screen to"deposit".ExecutingScreen.tsx, theonBackprop is changed from optional to required (onBack: (() => void) | undefined).Summary by CodeRabbit