Skip to content

Conversation

@ncarazon
Copy link
Contributor

@ncarazon ncarazon commented Feb 9, 2026

This PR fixes a bug where duplicating a post and editing it would lose all edits on page refresh.

Changes:

  • Changed shouldUseDraftValue condition from mode === "create" && isNil(post) to mode === "create", so duplicated posts also persist draft edits to localStorage

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced draft value persistence in the question creation interface to consistently apply when creating new questions or working with duplicates.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

🧹 Preview Environment Cleaned Up

The preview environment for this PR has been destroyed.

Resource Status
🌐 Preview App ✅ Deleted
🗄️ PostgreSQL Branch ✅ Deleted
⚡ Redis Database ✅ Deleted
🔧 GitHub Deployments ✅ Removed
📦 Docker Image ⚠️ Retained (auto-cleanup via GHCR policies)

Cleanup triggered by PR close at 2026-02-10T08:34:10Z

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 10, 2026

📝 Walkthrough

Walkthrough

A condition for draft value persistence in create mode was simplified by removing the post existence check, allowing draft values to apply to both new posts and duplicates. Explanatory comments were added to clarify the new behavior.

Changes

Cohort / File(s) Summary
Draft Handling Logic
front_end/src/app/(main)/questions/create/[content_type]/page.tsx
Simplified the condition for using draft values in create mode by removing the isNil(post) check. Draft values now persist for both new posts and duplicates when mode is "create", with supporting comments added.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A draft persists through create's refrain,
No post check needed, logic made plain,
Duplicates welcome, new posts alike,
Simplicity's path—just the way we like! ✨

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main change: enabling draft persistence for duplicated posts, which is exactly what the changeset addresses.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/post-duplicating

No actionable comments were generated in the recent review. 🎉


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ncarazon ncarazon merged commit 0d95ad0 into main Feb 10, 2026
14 checks passed
@ncarazon ncarazon deleted the fix/post-duplicating branch February 10, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants