Tooltip onOpenChange being fired with controlled state #1834
-
Hi there!, I have a tooltip with a controlled state and while testing the onOpenChange, I realised the event is being fired even if the open state does not change. is there a reason for this? https://codesandbox.io/s/spring-hill-3wljqi?file=/App.js:345-357 Thanks a lot |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
This is how controlled components work:
Right now, you are not updating the value in |
Beta Was this translation helpful? Give feedback.
-
@benoitgrelard although the props that you just mentioned are doing what you described, the issue is when the component didn't change the |
Beta Was this translation helpful? Give feedback.
This is how controlled components work:
onOpenChange
is the component telling you that the value is changingopen
is you controlling the valueRight now, you are not updating the value in
onOpenChange
so it just logs, but never changes.