#1833 - Toolbar buttons are stuck to the main comment form#1948
#1833 - Toolbar buttons are stuck to the main comment form#1948umputun merged 2 commits intoumputun:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1948 +/- ##
=======================================
Coverage 62.19% 62.19%
=======================================
Files 132 132
Lines 3026 3026
Branches 764 721 -43
=======================================
Hits 1882 1882
Misses 1140 1140
Partials 4 4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug where toolbar buttons were stuck to the main comment form by implementing proper textarea ID management. The core issue was that textarea IDs were being generated in the render function, causing instability.
- Moved textarea ID generation from render function to constructor for consistency
- Changed static property name from
textareaIdtotextareaCounterfor clarity - Added instance property
textareaIdto store the unique ID per component
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| comment-form.tsx | Refactored textarea ID generation to occur in constructor instead of render function |
| comment-form.spec.tsx | Updated test cleanup to reset the renamed counter property |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| static textareaId = 0; | ||
| static textareaCounter = 0; | ||
| /** unique textarea ID for this instance */ | ||
| textareaId: string; |
There was a problem hiding this comment.
The textareaId property should be initialized in the declaration or marked as definitely assigned. Consider either initializing it as textareaId!: string; or textareaId = ''; to indicate it will be assigned in the constructor.
| textareaId: string; | |
| textareaId!: string; |
Improve code quality based on review feedback: mark textareaId as readonly since it should never change after construction, and add JSDoc to static textareaCounter explaining its purpose.
Fixes #1833
I reworked
CommentForma little bit so it creates a uniquetextareaIdin constructor instead of render function