You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the Add Token → SAC trustline review flow, ChangeTrustInternal re-fetches
data that the Add Token screen already loaded, adding avoidable latency and
duplicate backend requests. Not user-visible beyond the extra round-trips.
Follow-up from the PR #2869 review (finding #6, [efficiency]).
Duplicate feeStats() round-trip.ChangeTrustInternal calls useNetworkFees() again even though the Add Token screen already fetched fees.
Only initialFee is threaded down from the parent — not recommendedFee — so
the child re-fetches to recover it.
Duplicate scanAsset.useChangeTrustData re-runs scanAsset for the
same ${code}-${issuer} the Add Token screen already scanned; the prior scan
result is not threaded down.
Proposed fix
Thread the already-fetched recommendedFee and the Add Token scan result down
into ChangeTrustInternal (via props) instead of re-fetching them in the child.
Related note to verify (not necessarily blocking)
fetchData is useCallback-memoized with networkDetails in its dep array and
the effect depends on [fetchData]. This is correct only while the networkDetails prop is referentially stable. If a parent ever passes a
freshly-constructed networkDetails each render, the memo breaks and fetchData
re-fires every render. Current tests pass, so the useGetAppData/redux source
appears stable — worth a quick confirmation while in this code.
Summary
In the Add Token → SAC trustline review flow,
ChangeTrustInternalre-fetchesdata that the Add Token screen already loaded, adding avoidable latency and
duplicate backend requests. Not user-visible beyond the extra round-trips.
Follow-up from the PR #2869 review (finding #6,
[efficiency]).Details
extension/src/popup/components/manageAssets/ManageAssetRows/ChangeTrustInternal/index.tsxfeeStats()round-trip.ChangeTrustInternalcallsuseNetworkFees()again even though the Add Token screen already fetched fees.Only
initialFeeis threaded down from the parent — notrecommendedFee— sothe child re-fetches to recover it.
scanAsset.useChangeTrustDatare-runsscanAssetfor thesame
${code}-${issuer}the Add Token screen already scanned; the prior scanresult is not threaded down.
Proposed fix
Thread the already-fetched
recommendedFeeand the Add Token scan result downinto
ChangeTrustInternal(via props) instead of re-fetching them in the child.Related note to verify (not necessarily blocking)
fetchDataisuseCallback-memoized withnetworkDetailsin its dep array andthe effect depends on
[fetchData]. This is correct only while thenetworkDetailsprop is referentially stable. If a parent ever passes afreshly-constructed
networkDetailseach render, the memo breaks andfetchDatare-fires every render. Current tests pass, so the
useGetAppData/redux sourceappears stable — worth a quick confirmation while in this code.
Context
feat/addtoken-sac-changetrust-review), headb314de9b.