fix: stay on question page when sending back to drafts#4424
fix: stay on question page when sending back to drafts#4424SylvainChevalier wants to merge 1 commit intomainfrom
Conversation
Instead of redirecting to the review queue (/questions/?status=pending), the page now stays on the current question after sending it back to drafts. This matches the expected behavior discussed in the issue. Closes #2176 Co-authored-by: Sylvain <SylvainChevalier@users.noreply.github.com>
📝 WalkthroughWalkthroughModified the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🚀 Preview EnvironmentYour preview environment is ready!
Details
ℹ️ Preview Environment InfoIsolation:
Limitations:
Cleanup:
|
|
lgtm. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
front_end/src/app/(main)/questions/actions.ts (1)
121-124: Trailing slash inconsistency withapprovePost.
draftPostcallsrevalidatePath(\/questions/${postId}`)(no trailing slash), whileapprovePostat Line 64 usesrevalidatePath(`/questions/${postId}/`)` (with trailing slash). Next.js normalizes both, so there is no functional bug, but it's worth aligning them for consistency.🔧 Optional alignment
export async function draftPost(postId: number) { await ServerPostsApi.makeDraft(postId); - revalidatePath(`/questions/${postId}`); + revalidatePath(`/questions/${postId}/`); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@front_end/src/app/`(main)/questions/actions.ts around lines 121 - 124, The revalidation path in draftPost is inconsistent with approvePost: change the call in draftPost (after ServerPostsApi.makeDraft) to use the same trailing-slash form as approvePost by calling revalidatePath(`/questions/${postId}/`) so both functions use the identical path normalization; locate the draftPost function and update its revalidatePath argument to include the trailing slash to match approvePost.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@front_end/src/app/`(main)/questions/actions.ts:
- Around line 121-124: The revalidation path in draftPost is inconsistent with
approvePost: change the call in draftPost (after ServerPostsApi.makeDraft) to
use the same trailing-slash form as approvePost by calling
revalidatePath(`/questions/${postId}/`) so both functions use the identical path
normalization; locate the draftPost function and update its revalidatePath
argument to include the trailing slash to match approvePost.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
front_end/src/app/(main)/questions/[id]/components/post_status_box.tsxfront_end/src/app/(main)/questions/actions.ts
Instead of redirecting to the review queue (/questions/?status=pending), the page now stays on the current question after sending it back to drafts.
Closes #2176
Generated with Claude Code
Summary by CodeRabbit