Skip to content

#377 [Frontend] [Feature] Integrate Soroban/Backend Search API for Global Certificate Search FIXED - #448

Closed
veloura-dev wants to merge 2 commits into
Tybravo:mainfrom
veloura-dev:#377--Frontend]--Feature]-Integrate-Soroban/Backend-Search-API-for-Global-Certificate-Search-FIX
Closed

#377 [Frontend] [Feature] Integrate Soroban/Backend Search API for Global Certificate Search FIXED#448
veloura-dev wants to merge 2 commits into
Tybravo:mainfrom
veloura-dev:#377--Frontend]--Feature]-Integrate-Soroban/Backend-Search-API-for-Global-Certificate-Search-FIX

Conversation

@veloura-dev

@veloura-dev veloura-dev commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

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:

files under frontend/app/search at origin/main: 0

Finding 2 — "Axios/fetch" resolves to fetch

axios entries in frontend/package.json: 0

Axios isn't in the project. The issue offers a choice, so I used native fetchzero new dependencies, consistent with the existing horizonService.ts.

Finding 3 — The backend endpoint does not exist yet

Only two certificate routes exist:

certificate.routes.ts:93     router.get("/", ...)        → ?creatorId=&limit=&skip=
v1/certificate.routes.ts:6   router.get('/:id', ...)

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

DEVELOPMENT_GUIDELINES.md:27 — Whenever you use `useSearchParams()`... 
immediately wrap the logic in a `<Suspense>` boundary to ensure it does not 
break the production build.

Search state belongs in the URL, which forces useSearchParams(). Git history confirms this bit the team before (commit 67d9828, "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.ts mapping to a non-existent src/ 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:

Mongo document Soroban contract
certificateId, stellarNetwork certificate_id, network
populated manifestId / assetId flat manifest_hash, content_hash
ISO date strings ledger seconds since epoch

Also tolerates certificates / results / items, and derives page from either page or skip+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

  • No API configured → sample data (source: "mock"), badge shown. Local dev works out of the box.
  • API configured but brokenrejects, error state + retry.

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) vs isFetching (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 live produced 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/GridView receive 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

Criterion Status Evidence
Search queries return correct data from the API Live backend on :4555 returned LIVE API - Backend Certificate One/Two, rendered correctly
Loading spinners show during fetch Test "AC2" asserts spinner + skeleton + aria-busy while pending, and removal after resolve
Data fetching using Axios/fetch Native fetch; no new dependency
Handle loading and error states Live 503 → error + working retry
Pass data to List/Grid views Both render from the same payload

Validation: tsc 0 errors · eslint 0 errors · frontend build ✅ (26→28 routes) · backend build ✅ · 41/41 new tests pass.

@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

@Kappa16 is attempting to deploy a commit to the DaniBravo Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@Tybravo

Tybravo commented Jul 29, 2026

Copy link
Copy Markdown
Owner

@veloura-dev Please fix the CI / build-and-check to pass successfully

@Tybravo

Tybravo commented Jul 29, 2026

Copy link
Copy Markdown
Owner

@veloura-dev
Please fetch upstream code and resolve conflict

@Tybravo

Tybravo commented Jul 30, 2026

Copy link
Copy Markdown
Owner

@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
@veloura-dev

Copy link
Copy Markdown
Contributor Author

@Tybravo Im sorry for the delay .....ive resolved the conflict

@veloura-dev

Copy link
Copy Markdown
Contributor Author

@veloura-dev Please fix the CI / build-and-check to pass successfully

im on it @Tybravo

@veloura-dev veloura-dev closed this by deleting the head repository Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Frontend] [Feature] Integrate Soroban/Backend Search API for Global Certificate Search

3 participants