fix(backend/realtime): add community_posts to supabase_realtime publication
The community feed's likes/dislikes/comments/reposts counters never live- updated for foreign actions because the table simply wasn't in the publication. useCommunityRealtime subscribed to UPDATE on community_posts, the channel opened cleanly, but no events ever arrived for that table — Supabase only broadcasts what's published. The notifications channel (rebreak.notifications, added in 20260511) was in the publication from day one, so users got the "X liked your post" banner correctly. That made the gap look like a frontend rendering bug all along; it was actually a missing one-line publication grant. After this migration deploys, the React-Query cache patcher in useCommunityRealtime will receive UPDATE events, patch the post in place, and PostCard will re-render with the correct displayedCount derived from post.likesCount + the (now-cleared) optimistic delta.
This commit is contained in:
parent
964dc2b6e0
commit
0679aa6218
@ -0,0 +1,15 @@
|
||||
-- Enable Supabase Realtime for rebreak.community_posts.
|
||||
--
|
||||
-- Why: foreign-like counts never updated in the feed because the table was
|
||||
-- never in the supabase_realtime publication. useCommunityRealtime hooks
|
||||
-- listen for UPDATE on community_posts (likes_count, dislikes_count,
|
||||
-- comments_count, reposts_count) and patch the React-Query cache so visible
|
||||
-- PostCards re-render with the new count. Without the publication entry the
|
||||
-- whole channel is silent — users only ever saw the notifications channel
|
||||
-- fire (rebreak.notifications was added in 20260511) and assumed realtime
|
||||
-- was working end to end. It wasn't, for posts.
|
||||
--
|
||||
-- After deploy, the count on a PostCard should reflect a foreign user's like
|
||||
-- within ~200ms of the API write, without pull-to-refresh.
|
||||
|
||||
ALTER PUBLICATION supabase_realtime ADD TABLE rebreak.community_posts;
|
||||
Loading…
x
Reference in New Issue
Block a user