Skip to content

fix(feed): native post detail uses real API (was mock data)#532

Merged
KishParikh13 merged 1 commit into
v2from
fix/feed-post-detail-real-api
Jun 17, 2026
Merged

fix(feed): native post detail uses real API (was mock data)#532
KishParikh13 merged 1 commit into
v2from
fix/feed-post-detail-real-api

Conversation

@KishParikh13

Copy link
Copy Markdown
Collaborator

The bug

The native post-detail screen packages/frontend/app/feed/[id].tsx built the post and its thread from mock fixtures — it imported centerBoards / eventBoards from components/boards/__mocks__/mockData.ts and synthesized a fake post + replies. So opening a board/feed post by id (a deep link, or a push-notification tap — the backend sends /feed/:postId) rendered fake content instead of the real post.

The web variant (app/feed/[id].web.tsx, which delegates to the native screen on mobile) and the Feed tab (app/(tabs)/feed.tsx) already use the real API; only this native route was stuck on mocks.

What changed

app/feed/[id].tsx now loads real data:

  • Fetches the aggregated feed (fetchAggregatedFeed) — the same real-data source the Feed tab and Home board peek read from (scoped to public + the user's center board + boards for events they've joined).
  • Finds the post by the route id, matching either the raw API post id (deep links / push) or the board-scoped compound key ${groupId}-${postId} the Feed tab uses for in-app selection.
  • Maps it via boardPostToMessage + buildFeedPostFromMessage (deriving the source label/kind from the aggregated post's sourceKind / sourceLabel) and renders the shared PostThread component.
  • PostThread loads the real replies (fetchBoardPostReplies) and already handles reactions, replies, and pin/edit/delete against the real API.
  • Clean loading, error (retryable), and not-found states, using the existing NativeChatHeader + useColors tokens to match surrounding screens.

No new API endpoints were invented — this reuses fetchAggregatedFeed, the exact pattern already used by the Feed tab and Home peek. The __mocks__ file is left untouched (other tests/screens use it); this screen simply no longer imports it.

How it was verified

  • npx tsc --noEmit (frontend) — passes, 0 errors (deps installed via npm ci in the worktree since node_modules was absent).
  • npx vitest run (frontend) — 198 tests passed, 12 files.
  • Confirmed no __mocks__ / centerBoards / eventBoards references remain in the screen.

Caveat: the repo's vitest suite excludes app/**, so a green test run does not exercise this screen directly — correctness rests on the typecheck + reusing the already-working fetchAggregatedFeedPostThread path. Like the Feed tab, post lookup is bounded by the aggregated feed page (limit 100); a deep-linked post older than that window would fall through to the not-found state (there is no single-post-by-id endpoint to fetch against).

🤖 Generated with Claude Code

…ata)

The native post-detail screen (app/feed/[id].tsx) built its post and thread
from __mocks__ fixtures (centerBoards/eventBoards), so opening a board/feed
post by id — e.g. a deep link or push-notification tap (/feed/:postId) —
rendered fake content instead of the real post.

Rewrite the screen to load the real post from the aggregated feed (the same
real-data source the Feed tab and Home peek read), match it by route id (raw
post id from deep links, or the board-scoped compound key the Feed tab uses),
map it via boardPostToMessage + buildFeedPostFromMessage, and render the shared
PostThread component — which already loads real replies and handles reactions,
replies, pin/edit/delete. Adds clean loading, error (retryable), and not-found
states matching existing patterns (NativeChatHeader + useColors tokens).

No mock imports remain in this screen; the __mocks__ file is left untouched
for other tests/screens.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying chinmaya-janata with  Cloudflare Pages  Cloudflare Pages

Latest commit: 691a907
Status: ✅  Deploy successful!
Preview URL: https://3ede2818.project-janatha.pages.dev
Branch Preview URL: https://fix-feed-post-detail-real-ap.project-janatha.pages.dev

View logs

@KishParikh13 KishParikh13 merged commit 38f339f into v2 Jun 17, 2026
3 checks passed
@KishParikh13 KishParikh13 deleted the fix/feed-post-detail-real-api branch June 17, 2026 19:24
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.

1 participant