-
-
Notifications
You must be signed in to change notification settings - Fork 535
Description
Describe the bug
If you control the content
prop with conditional logic, only the initial value is used for the actual display content.
Version of Package
v5.3.0
To Reproduce
Create a tooltip like so:
const [state, setState] = useState(true);
return (
<>
<div id="some-id" onClick={() => setState(!state)}>text</div>
<Tooltip anchorId="some-id" content={state ? 'some content' : ''}/>
</>
)
Expected behavior
Changing the content prop should cause the displayed tooltip to change to ''
(no tooltip). Instead, it will stay as "some content" in the above example regardless of the value of state
Screenshots
None for now.
Desktop (please complete the following information if possible or delete this section):
- OS: macOS
- Browser: Brave (Chromium-based)
- Version 1.46.144
Additional context
This is a real blocker for me because if I try to use the content="."
hack to fix #872 and use children
for the conditional instead, then if my conditional returns null
, then a tooltip is shown with that period in it instead of nothing, like I want. So there is no way to show conditional logic that might return null
, so there is no way to conditionally disable a tooltip that I know of.