Skip to content

Make the intent detail page update live instead of one-time fetch #237

Description

@james2177

Description: src/app/explore/[id]/page.tsx fetches an intent's details once via useIntent(params.id) with no revalidation, so a user watching a pending intent's detail page will never see it transition to filled/failed without a manual reload. Add live updates using the same REST+WebSocket layering pattern documented for the rest of the app.

Problem Statement & Context: This is the one canonical "watch a specific intent" page in the app, yet it's the only major data view that doesn't follow the project's own documented live-data pattern (docs/architecture.md), making it feel broken relative to the rest of the product once a user actually waits on this page for their swap to settle.

Scope & Acceptance Criteria:

  • useIntent (or a new hook) gains either SWR revalidation (refreshInterval) or a WebSocket subscription filtered to the single intent ID, following the existing useIntentFeed/useLiveIntents pattern described in docs/architecture.md.
  • The detail page visually reflects a status change (e.g. pendingfilled) without a manual reload, including the txHash/settlement link appearing once available.
  • Out of scope: changing the WebSocket message schema (FeedItem) on the backend — if per-intent filtering isn't feasible over the existing single shared socket, polling via SWR's refreshInterval is an acceptable fallback; justify the choice in the PR.
  • Also fix the missing CopyButton import and copy/copied undefined references currently present in this file's txHash section while you're here.

Implementation Guidelines:

  1. Key files: src/hooks/useIntent.ts, src/app/explore/[id]/page.tsx, src/hooks/useWebSocket.ts, docs/architecture.md, docs/websocket-protocol.md.
  2. If you add WebSocket-based updates, follow the mergeById/isLive conventions from useLiveIntents.ts so the pattern stays consistent for future maintainers, per the explicit guidance in docs/architecture.md.
  3. Edge cases: don't keep polling/subscribed forever once an intent reaches a terminal state (filled/failed) — stop refreshing to avoid wasted requests; handle the intent disappearing/erroring mid-watch.
  4. Testing: extend src/app/explore/[id]/page.test.tsx to cover a status transition arriving via the new update mechanism; verify polling/subscription stops after a terminal status in a dedicated test case.

Definition of Done:

  • Code written, tested, documented (docs/websocket-protocol.md updated if a new subscription shape is introduced).
  • Acceptance criteria met, including the CopyButton/copy-state fix.
  • PR passes CI.
  • Reviewed and approved.

Resources: docs/architecture.md, docs/websocket-protocol.md, src/hooks/useIntent.ts

Complexity: High (200 points)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions