Skip to main content

What It Does

Repost someone else’s recipe or post to share it on your profile. Similar to a retweet.
Reposts exist in the database (tables, triggers, counters) and the data layer (types, transforms, RPC responses include repost_count and is_reposted), but the repost button is intentionally hidden in the mobile app UI. The DetailActionBar component has the repost action commented out. The infrastructure is ready — it just needs to be wired up when the feature is enabled.

User Flow

Not currently active in the mobile app — the repost button is hidden in DetailActionBar. The flow below describes the intended behavior when enabled.
User taps repost icon on detail view or card → optimistic UI update → direct Supabase call (supabase.from('recipe_reposts').insert/delete or supabase.from('post_reposts').insert/delete).
The mobile app calls Supabase directly for reposts. Unlike favorites, useToggleRepost uses invalidateQueries on success (rather than pure optimistic updates) because repost state is less latency-sensitive than the heart animation.

Web API Routes (Phase 2)

MethodRoutePurpose
POST/api/recipes/[id]/repostRepost a recipe
DELETE/api/recipes/[id]/repostUn-repost a recipe
POST/api/posts/[id]/repostRepost a post
DELETE/api/posts/[id]/repostUn-repost a post

Database

TableKey ColumnsNotes
recipe_repostsuser_id (FK→profiles), recipe_id (FK→recipes)Composite PK
post_repostsuser_id (FK→profiles), post_id (FK→posts)Composite PK

RLS Policies

SELECT public, INSERT/DELETE auth.uid() = user_id

Triggers

TriggerTableEventsFunction
trigger_update_recipe_repost_countrecipe_repostsINSERT, DELETEupdate_recipe_repost_count()
trigger_update_post_repost_countpost_repostsINSERT, DELETEupdate_post_repost_count()