Autoload transaction dashboard when tx hash is populated#2044
Autoload transaction dashboard when tx hash is populated#2044jeesunikim wants to merge 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds automatic loading behavior to the Transaction dashboard when a transaction hash is already present (e.g., from persisted/query-string state), and updates the auto-generated network limits constants.
Changes:
- Auto-refetch transaction details when a valid tx hash + supported network + RPC URL are present.
- Update
networkLimits.tsconstants (state size windows + config JSON cost parameters).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/constants/networkLimits.ts |
Updates auto-generated network limit/config constants for mainnet/testnet/futurenet. |
src/app/(sidebar)/transaction/dashboard/page.tsx |
Adds an effect to auto-load transaction details when the tx hash input is populated and valid. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| useEffect(() => { | ||
| if ( | ||
| transactionHashInput && | ||
| !transactionHashInputError && | ||
| isCurrentNetworkSupported && | ||
| network.rpcUrl | ||
| ) { | ||
| fetchTxDetails(); | ||
| trackEvent(TrackingEvent.TRANSACTION_DASHBOARD_LOAD_TX, {}); | ||
| } | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }, [ | ||
| transactionHashInput, | ||
| transactionHashInputError, | ||
| isCurrentNetworkSupported, | ||
| network.rpcUrl, | ||
| ]); |
There was a problem hiding this comment.
The auto-load effect relies on transactionHashInputError, but that error state is only set in the <Input onChange> handler. When transactionHashInput is populated programmatically (e.g., from txDashboard.transactionHash on page load or from latestTxn.hash), transactionHashInputError may still be empty even if the hash is invalid, causing a fetch with an invalid hash. Consider validating the hash in the effect (or when setting transactionHashInput) and setting transactionHashInputError before calling fetchTxDetails.
| useEffect(() => { | ||
| if ( | ||
| transactionHashInput && | ||
| !transactionHashInputError && | ||
| isCurrentNetworkSupported && | ||
| network.rpcUrl | ||
| ) { | ||
| fetchTxDetails(); | ||
| trackEvent(TrackingEvent.TRANSACTION_DASHBOARD_LOAD_TX, {}); | ||
| } | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }, [ | ||
| transactionHashInput, | ||
| transactionHashInputError, | ||
| isCurrentNetworkSupported, | ||
| network.rpcUrl, | ||
| ]); |
There was a problem hiding this comment.
This new effect triggers fetchTxDetails() + TRANSACTION_DASHBOARD_LOAD_TX tracking whenever a valid hash is present, but the form onSubmit below also refetches and tracks the same event. That can lead to duplicate network requests and double-counted analytics when users still click “Load transaction”. Consider gating the effect to only run for pre-populated hashes (e.g., from txDashboard.transactionHash on mount) or removing one of the tracking/refetch paths.
| "live_soroban_state_size_window": [ | ||
| "698933560", | ||
| "699854984", | ||
| "700498804", | ||
| "700342140", | ||
| "700482104", | ||
| "700881920", | ||
| "701866036", | ||
| "702327232", | ||
| "702236112", | ||
| "702418272", | ||
| "702794004", | ||
| "703655676", | ||
| "703906824", | ||
| "704134152", | ||
| "704376184", | ||
| "704566128", | ||
| "704783500", | ||
| "705684296", | ||
| "706367628", | ||
| "706533156", | ||
| "706697884", | ||
| "706985136", | ||
| "707803656", | ||
| "707819944", | ||
| "707582232", | ||
| "708142500", | ||
| "708686816", | ||
| "709541828", | ||
| "710004992", | ||
| "709889972" | ||
| "730964418", | ||
| "730506222", | ||
| "729773650", | ||
| "729352446", | ||
| "729319902", |
There was a problem hiding this comment.
networkLimits.ts is marked as auto-generated, but this PR updates large blocks of network-limit constants that don’t appear related to the PR title (“Autoload transaction dashboard…”). If these updates are intentional, it would help to mention why they’re needed here; otherwise consider splitting them into a separate PR to keep the functional change reviewable.
|
Preview is available here: |
No description provided.