fix: refactor `DatePicker` component to handle `onChange` callback pr…
name: Pull Request about: Create a pull request to improve this repository title: "Refactor DatePicker Component for Improved onChange Handling" labels: "" assignees: ""
Description
Linked issue: #5044
Problem The DatePicker component had redundant ternary operations for handling the onChange callback, and default onChange implementations were not necessary. This led to potential bugs and unnecessary complexity in the component’s behavior.
Changes Replaced ternary operations with optional chaining for better readability and functionality. Removed the default onChange implementation that was redundant and not used effectively. Updated handling of onChange and other props to ensure correct behavior.
Screenshots
To reviewers
Please review the changes to ensure that the DatePicker component now handles the onChange callback correctly and that the code is clean and well-tested. Feedback on the updated behavior and any edge cases is appreciated.
Contribution checklist
- [ Yes] I have followed the contributing guidelines.
- [ No] I have added sufficient test coverage for my changes.
- [ Yes] I have formatted my code with Prettier and checked for linting issues with ESLint for code readability.
Can you look into the merge conflict?
This is a significant readability improvement; bravo! The dropping of the (empty) default func
DatePicker.defaultProps.onChangeis especially helpful. Without major logic changes, I presume the existing test coverage is still passing. Looks solid.
Dylan F
Reviewed with ❤️ by PullRequest
THank you very much for your support ,it's really inspirational
Can you look into the merge conflict?
done
This might be a duplicate of #5045 (great minds think alike!) that was merged very recently. After your merge commit, the diff looks empty.
yes this seems unnecessary, please confirm this is indeed what's left over.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 96.85%. Comparing base (
c834746) to head (fb72ae6). Report is 26 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #5061 +/- ##
=======================================
Coverage 96.85% 96.85%
=======================================
Files 29 29
Lines 3343 3343
Branches 1390 1390
=======================================
Hits 3238 3238
Misses 105 105
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.