adevinta / spark

✨ Simple, Modular & Accessible UI Components for your React Applications
https://sparkui.vercel.app
MIT License
51 stars 16 forks source link

fix(combobox): removed unnecessary undefined type for combobox onValu… #2209

Closed Powerplex closed 3 weeks ago

Powerplex commented 3 weeks ago

…eChange

TASK: #2208

Description, Motivation and Context

onValueChange accepted string | undefined as a first parameter in its callback (single selection mode only).

It means that our consumer are forced to check the type:

<Combobox value={value} onValueChange={(value)  => {
  if (value !== undefined) setValue(value)
}}

But I think such a case can't happen. Once a Combobox is controlled, its value must remain a string.

Types of changes

codecov[bot] commented 3 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 97.63%. Comparing base (2d2e366) to head (568b5a7). Report is 2 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2209 +/- ## ======================================= Coverage 97.63% 97.63% ======================================= Files 753 753 Lines 5925 5925 Branches 2086 2119 +33 ======================================= Hits 5785 5785 Misses 138 138 Partials 2 2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.