community-platform
community-platform copied to clipboard
feat: add guard clause to capitalizeFirstLetter
PR Checklist
- [x] - Commit messages are descriptive, it will be used in our Release Notes
PR Type
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Developer experience (improves developer workflows for contributing to the project)
Description
Somehow an entirely empty how-to got it's way into the database. That caused the main how-to page to entirely crash for admins who could see the post (even though it wasn't published for everyone else).
Codecov Report
Attention: Patch coverage is 75.00000%
with 1 lines
in your changes are missing coverage. Please review.
Project coverage is 66.65%. Comparing base (
1f7fc1d
) to head (9605ed0
). Report is 4 commits behind head on master.
Files | Patch % | Lines |
---|---|---|
src/pages/Howto/Content/HowtoList/HowToCard.tsx | 0.00% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #3429 +/- ##
==========================================
- Coverage 66.65% 66.65% -0.01%
==========================================
Files 427 427
Lines 13464 13466 +2
Branches 2429 2431 +2
==========================================
+ Hits 8975 8976 +1
- Misses 4443 4444 +1
Partials 46 46
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
2 flaky tests on run #5478 ↗︎
![]() |
![]() |
![]() |
![]() |
![]() |
Details:
Merge branch 'master' into fix/how-to-string-util | |||
Project: onearmy-community-platform | Commit: 9605ed079e |
||
Status: Passed | Duration: 04:40 💡 | ||
Started: Apr 30, 2024 12:33 PM | Ended: Apr 30, 2024 12:37 PM |
howto/write.spec.ts • 1 flaky test • ci-chrome
Test | Artifacts | |
---|---|---|
[How To] > [Create a how-to] > [By Authenticated] |
Test Replay
Screenshots
Video
|
profile.spec.ts • 1 flaky test • ci-chrome
Test | Artifacts | |
---|---|---|
[Profile] > [By User] > [Can contact profiles by default] |
Test Replay
Screenshots
Video
|
Review all test suite changes for PR #3429 ↗︎
hmm ideally there should be a conditional when calling the method capitalizeFirstLetter(word || '')
as it already only accepts string
, not undefined
or null
.
Improving our usage of typescript should help with this kind of bugs.
@mariojsnunes Have added. How-to's shouldn't have an empty title though, I'd say it's typed correctly otherwise everything would have to be optional?
Sorry I wasn't clear. I meant to say that your first changes shouldn't be necessary, because
capitalizeFirstLetter
only accepts a string already, not null/undefined.
The root cause is likely somewhere higher up where an assignment to howto.title
is undefined.
But this could be merged if urgent.
@mariojsnunes Oh I understand now. Yes, makes sense and I agree. Not urgent now as I also dealt with the bad data too.
I had been leaving this open to remind myself to do the bigger fix but I need it now to trigger a release candidate(!) so going to merge it in.
:tada: This PR is included in version 1.176.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket: