Skip to content

fix: prevent review comment form re-opening pre-populated after submit#419

Merged
tomasz-tomczyk merged 1 commit intomainfrom
fix-review-comment-duplicate-form
May 2, 2026
Merged

fix: prevent review comment form re-opening pre-populated after submit#419
tomasz-tomczyk merged 1 commit intomainfrom
fix-review-comment-duplicate-form

Conversation

@tomasz-tomczyk
Copy link
Copy Markdown
Owner

Summary

  • Review-level comment form was re-rendering pre-populated with the just-submitted text after a successful save, looking like the form duplicated.
  • renderReviewConversation snapshots any non-empty review:new textarea as a "draft to preserve" so SSE/refresh re-renders don't blow away in-progress typing. After submit the textarea still held the submitted text, so the snapshot captured it and re-rendered the form pre-populated.
  • Fix clears the review:new textarea explicitly in addReviewComment before re-rendering. Doesn't affect the editor (separate formKey).

Review

  • Code review: passed
  • Parity audit: N/A (crit-web uses state-driven formObj.draftBody, not a DOM-snapshot heuristic — bug doesn't apply)
  • Pre-commit: gofmt clean, golangci-lint 0 issues, go test -race PASS
  • Share integration tests: PASS

Test plan

  • E2E regression test added: e2e/tests/review-comments.spec.ts — "after submit, form does not re-open pre-populated with submitted text"
  • Verified red without the fix, green with it
  • Full review-comments E2E suite (14 tests) passes

🤖 Generated with Claude Code

renderReviewConversation snapshots any non-empty textarea value as a
"draft to preserve" so SSE/refresh re-renders don't blow away in-progress
typing. After a successful submit the textarea still contained the just-
submitted text, so the snapshot captured it and the form was rendered
again pre-populated — looking like a duplicate.

Clear the textarea explicitly in addReviewComment before re-rendering.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.30%. Comparing base (44df509) to head (2b483bc).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #419      +/-   ##
==========================================
+ Coverage   67.27%   67.30%   +0.03%     
==========================================
  Files          26       26              
  Lines        9668     9668              
==========================================
+ Hits         6504     6507       +3     
+ Misses       2653     2651       -2     
+ Partials      511      510       -1     
Flag Coverage Δ
e2e 34.18% <ø> (+0.01%) ⬆️
unit 63.50% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tomasz-tomczyk tomasz-tomczyk merged commit fd74c94 into main May 2, 2026
8 checks passed
@tomasz-tomczyk tomasz-tomczyk deleted the fix-review-comment-duplicate-form branch May 2, 2026 09:25
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.

1 participant