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.
pending → filled) 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:
- Key files:
src/hooks/useIntent.ts, src/app/explore/[id]/page.tsx, src/hooks/useWebSocket.ts, docs/architecture.md, docs/websocket-protocol.md.
- 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.
- 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.
- 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)
Description:
src/app/explore/[id]/page.tsxfetches an intent's details once viauseIntent(params.id)with no revalidation, so a user watching apendingintent's detail page will never see it transition tofilled/failedwithout 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 existinguseIntentFeed/useLiveIntentspattern described indocs/architecture.md.pending→filled) without a manual reload, including thetxHash/settlement link appearing once available.FeedItem) on the backend — if per-intent filtering isn't feasible over the existing single shared socket, polling via SWR'srefreshIntervalis an acceptable fallback; justify the choice in the PR.CopyButtonimport andcopy/copiedundefined references currently present in this file'stxHashsection while you're here.Implementation Guidelines:
src/hooks/useIntent.ts,src/app/explore/[id]/page.tsx,src/hooks/useWebSocket.ts,docs/architecture.md,docs/websocket-protocol.md.mergeById/isLiveconventions fromuseLiveIntents.tsso the pattern stays consistent for future maintainers, per the explicit guidance indocs/architecture.md.filled/failed) — stop refreshing to avoid wasted requests; handle the intent disappearing/erroring mid-watch.src/app/explore/[id]/page.test.tsxto 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:
docs/websocket-protocol.mdupdated if a new subscription shape is introduced).CopyButton/copy-state fix.Resources:
docs/architecture.md,docs/websocket-protocol.md,src/hooks/useIntent.tsComplexity: High (200 points)