chore: unsafe type assertion in CannedResponseForm#38341
Conversation
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
|
WalkthroughRemoved an unsafe type assertion in CannedResponseForm: the Tags component now receives the form value directly instead of casting it with Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
dougfabris
left a comment
There was a problem hiding this comment.
Thanks for the contribution!
For this small refactor we don't need to add the changeset, so you can remove it :)
|
Thanks for the review @dougfabris ! I've removed the changeset file as suggested. Please review when you get a chance. 🙏 |
apps/meteor/client/views/omnichannel/cannedResponses/components/CannedResponseForm.tsx
Outdated
Show resolved
Hide resolved
CannedResponseForm
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #38341 +/- ##
===========================================
+ Coverage 70.77% 70.79% +0.01%
===========================================
Files 3159 3159
Lines 109401 109397 -4
Branches 19675 19673 -2
===========================================
+ Hits 77428 77443 +15
+ Misses 29944 29922 -22
- Partials 2029 2032 +3
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Co-authored-by: Douglas Fabris <27704687+dougfabris@users.noreply.github.com>
Description
This PR removes an unsafe type assertion (
as unknown as string[]) from theCannedResponseFormcomponent. The fix uses nullish coalescing (??) to safelyhandle potentially undefined values coming from React Hook Form.
This improves type safety while keeping the existing behavior unchanged.
Related issue
Changes proposed
as unknown as string[]type assertion.// FIXME: fix typescomment.value ?? []to provide a default empty array when the value isundefined.
Before
After
Verification
COMM-133
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.