Add Token SAC review re-fetches fee + scan data the Add Token screen already loaded

Aperta
#2,908 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
72/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
typescript
Ambito
frontend

Direzione di ricerca

Inizia in extension/src/popup/components/manageAssets/ManageAssetRows/ChangeTrustInternal/index.tsx e traccia il flusso delle props, di useNetworkFees e di useChangeTrustData della schermata Add Token. Conferma che i dati correnti di useGetAppData/redux siano referenzialmente stabili, quindi verifica che i test esistenti continuino a passare. Il lavoro è completato quando la revisione utilizza recommendedFee e il risultato della scansione già caricati, senza richieste duplicate a feeStats o scanAsset.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

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]).

Details

extension/src/popup/components/manageAssets/ManageAssetRows/ChangeTrustInternal/index.tsx

  • 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.

Context

  • Source: local PR review of #2869 (feat/addtoken-sac-changetrust-review), head b314de9b.
  • Severity: low (latency / duplicate requests only; no correctness or security impact).
Lingua principale
TypeScript
Stelle
122
Fork
62
Merge medio
4g 19h
PR unite (30g)
41

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di stellar/freighter

Tutte le issue di stellar/freighter

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.