[Component] - Select onValueChange bug #2062
Labels
Component: select
Related to alert-dialog component
Component
Related to a component
Type: Bug
A bug to fix
Milestone
While using the
Select
component in controlled mode, two issues have been observed:onValueChange
prop is executed on initial render, even though the value has not been changed.onValueChange
prop is executed twice.Repro ➡ https://stackblitz.com/edit/stackblitz-starters-ulfsq2?file=pagesContent%2Findex.tsx
The problem seems to originate from
packages/components/select/src/SelectContext.tsx
, specifically this piece of code:The weird thing is, when we comment out what's inside the
useEffect
, all the tests still pass. And even when we interact with the component in the browser (in both controlled and uncontrolled modes), it doesn't seem to break anythingThe text was updated successfully, but these errors were encountered: