fix(feed): native post detail uses real API (was mock data)#532
Merged
Conversation
…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>
Deploying chinmaya-janata with
|
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
The native post-detail screen
packages/frontend/app/feed/[id].tsxbuilt the post and its thread from mock fixtures — it importedcenterBoards/eventBoardsfromcomponents/boards/__mocks__/mockData.tsand 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].tsxnow loads real data: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).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.boardPostToMessage+buildFeedPostFromMessage(deriving the source label/kind from the aggregated post'ssourceKind/sourceLabel) and renders the sharedPostThreadcomponent.PostThreadloads the real replies (fetchBoardPostReplies) and already handles reactions, replies, and pin/edit/delete against the real API.NativeChatHeader+useColorstokens 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 vianpm ciin the worktree sincenode_moduleswas absent).npx vitest run(frontend) — 198 tests passed, 12 files.__mocks__/centerBoards/eventBoardsreferences 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-workingfetchAggregatedFeed→PostThreadpath. 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