#377 [Frontend] [Feature] Integrate Soroban/Backend Search API for Global Certificate Search FIXED - #448
Conversation
…obal Certificate Search FIXED
|
@Kappa16 is attempting to deploy a commit to the DaniBravo Team on Vercel. A member of the Team first needs to authorize it. |
|
@veloura-dev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
@veloura-dev Please fix the CI / build-and-check to pass successfully |
|
@veloura-dev |
|
@veloura-dev and @Kappa16 why do we have both of you on this Issue implementation? This is not accepted |
…Backend-Search-API-for-Global-Certificate-Search-FIX
|
@Tybravo Im sorry for the delay .....ive resolved the conflict |
im on it @Tybravo |
close #377
Part A · Findings
Finding 1 — The premise of the issue was false
The issue says "Connect the search UI to the backend," implying a UI existed to connect. It did not:
Finding 2 — "Axios/fetch" resolves to fetch
Axios isn't in the project. The issue offers a choice, so I used native
fetch— zero new dependencies, consistent with the existinghorizonService.ts.Finding 3 — The backend endpoint does not exist yet
Only two certificate routes exist:
There is no search endpoint. Neither route can serve global search: one requires a
creatorId(scoped to one user), the other is a single-ID lookup.This is the most consequential finding, and it shaped the whole design. I could not verify against a real endpoint, so I made the client resilient to how it will eventually be built rather than betting on one shape.
Finding 4 — A documented build-breaker I had to respect
Search state belongs in the URL, which forces
useSearchParams(). Git history confirms this bit the team before (commit67d9828, "wrap useSearchParams in Suspense boundaries for production build").Finding 5 — The test suite was already red
Baseline before I touched anything: 6 suites failing, 2 tests failing. Two unrelated causes — a
jest.config.tsmapping to a non-existentsrc/directory (4 suites), and two genuine assertion bugs. Establishing this baseline first is what lets me prove I introduced no regressions.Part B · Fix Features
1. Dual-shape normalization — directly answers Finding 3
The parser accepts both plausible backend shapes:
certificateId,stellarNetworkcertificate_id,networkmanifestId/assetIdmanifest_hash,content_hashAlso tolerates
certificates/results/items, and derivespagefrom eitherpageorskip+limit. When the endpoint lands, no UI change is needed — and it never throws on a sparse record.2. Fails loudly when it matters, degrades quietly when it doesn't
source: "mock"), badge shown. Local dev works out of the box.Silently swallowing a real backend failure would hide outages during integration — worse than useless.
3. Race-condition safety
Every request gets a monotonic id +
AbortController. Superseded responses are discarded, so a slow"a"cannot overwrite a fast"aurora". This is the classic search bug and it's invisible until production latency exposes it.4. Two distinct loading states
isLoading(nothing on screen → full skeleton) vsisFetching(refining → inline spinner). Refining a search dims existing results instead of blanking the page.5. Debounce — one request per pause, not per keystroke
Verified against the live server log: typing
liveproduced one request, not four.6. URL as single source of truth
?q,?view,?status,?network,?sort,?page→ shareable, reload-safe, back/forward-safe — wrapped in<Suspense>per Finding 4.7. Presentational views
ListView/GridViewreceive already-fetched data and own no state, satisfying "Pass data to List/Grid views" and the repo's dumb-component rule.Part C · Acceptance criteria
:4555returnedLIVE API - Backend Certificate One/Two, rendered correctlyaria-busywhile pending, and removal after resolvefetch; no new dependencyValidation:
tsc0 errors ·eslint0 errors · frontend build ✅ (26→28 routes) · backend build ✅ · 41/41 new tests pass.