Skip to content

Surface feed post Edit in header and fix community edit/save behavior#23

Open
ukuku360 wants to merge 2 commits into
mainfrom
codex/add-edit-functionality-for-posts-and-comments-v0wdqz
Open

Surface feed post Edit in header and fix community edit/save behavior#23
ukuku360 wants to merge 2 commits into
mainfrom
codex/add-edit-functionality-for-posts-and-comments-v0wdqz

Conversation

@ukuku360

Copy link
Copy Markdown
Owner

Motivation

  • Make feed post editing discoverable by moving the owner Edit action from the crowded action stack into the post header/status cluster so it's easier to find and use.
  • Fix community edit/save UX where pressing Save did not reflect the update immediately and could appear to not persist.
  • Improve error visibility for community edit failures caused by missing Supabase RLS update permissions.

Description

  • Moved feed card owner edit action into the header/status cluster and added rk-post-quick-edit styles for consistent header action visuals and disabled/loading feedback (apps/web/src/features/feed/pages/FeedPage.tsx, apps/web/src/app/styles.css).
  • Added isSameAuthorByFallback helper and editFeedPost / editFeedComment flows to support inline header editing for feed posts and prompt-based edits for feed comments, including per-item pending state tracking (isPostEditPendingByPostId, isCommentEditPendingByCommentId) (FeedPage.tsx).
  • Implemented inline edit UI in community cards and comment edit flow: added edit form, submit/cancel, and pending state handling in CommunityPostCard and CommunityCommentSection, and wired onEdit through CommunityFeed (CommunityPostCard.tsx, CommunityCommentSection.tsx, CommunityFeed.tsx).
  • Hardened community edit persistence by updating the local query cache on edit success (content and updated_at) then awaiting query invalidation, and added handleEdit wrapper that calls the mutation (CommunityFeed.tsx).
  • Improved server-side error messaging for missing DB update permissions by detecting common PostgREST/Supabase error codes and throwing a clearer actionable message in updateCommunityPost and updateComment service functions, and added updateComment/updateCommunityPost and updatePost helpers where needed (apps/web/src/services/community/community.service.ts, apps/web/src/services/comments/comments.service.ts, apps/web/src/services/posts/posts.service.ts).
  • Added updated_at to CommunityPost and CommunityComment types and extended supabase_schema.sql to add updated_at, update policies/triggers, and keep DB schema compatible with edit flows (apps/web/src/types/domain.ts, supabase_schema.sql).

Testing

  • Ran TypeScript build/typecheck with cd apps/web && npm run typecheck and it succeeded.
  • Ran ESLint with cd apps/web && npm run lint and it succeeded.
  • Started the dev server and performed an automated Playwright smoke capture of the feed and community pages to validate header edit visibility and the community edit/save flow, which completed successfully.

Codex Task

@vercel

vercel Bot commented Feb 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
rk-explore Ready Ready Preview, Comment Feb 19, 2026 5:14am

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3c8c739131

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +373 to +377
const viewerLabel = viewer.label.trim().toLowerCase()
const ownerLabel = (ownerAuthor ?? '').trim().toLowerCase()
if (!viewerLabel || !ownerLabel) return false

return viewerLabel === ownerLabel

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restrict fallback ownership check to missing user IDs

This fallback returns true whenever display names match, even after a user-id mismatch, so two accounts with the same nickname will both be treated as owners and see the new Edit controls for each other’s feed posts/comments. Because the edit flows call update mutations once this guard passes, this broadens edit eligibility beyond actual ownership; the fallback should only run when ownerUserId is absent.

Useful? React with 👍 / 👎.

e.preventDefault()
if (normalizedEditContent.length === 0 || normalizedEditContent === comment.content) return

await editCommentMutation.mutateAsync({ commentId: comment.id, text: normalizedEditContent })

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Catch comment edit mutation failures before returning

mutateAsync rejects on failure even when onError runs, and this submit handler does not catch that rejection; since the form calls it via void handleEditSubmit(...), failed saves (for example RLS/network errors) produce unhandled promise rejections in the browser. Wrap this await in try/catch (or use mutate) so edit failures stay fully handled by component state.

Useful? React with 👍 / 👎.


try {
setIsEditPending(true)
await onEdit(post.id, normalizedEditContent)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle post edit mutation rejections in submit path

If onEdit fails, this await rejects and bubbles out of the async form submit handler because there is no catch, leaving an unhandled rejection despite CommunityFeed already setting a user-facing error state in onError. Catching the rejection locally avoids noisy runtime errors and keeps the edit UX failure path controlled.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant