Skip to content

Commit

Permalink
Prevents calling hide tooltip if already destroyed. (#2341)
Browse files Browse the repository at this point in the history
* Removed the unsupported props from the Tooltip.

* Updated the instance.hide in tooltip to run only if the instance is not destroyed.
  • Loading branch information
deepakjosp authored Oct 10, 2024
1 parent 4570882 commit b5b1af0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
8 changes: 0 additions & 8 deletions src/components/Dropdown/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,6 @@ Dropdown.propTypes = {
* To specify the content to be rendered inside the Dropdown.
*/
children: PropTypes.node,
/**
* To specify whether the Dropdown menu width needs to be set to auto or not.
*/
autoWidth: PropTypes.bool,
/**
* To provide external classnames to Dropdown target wrapper.
*/
Expand Down Expand Up @@ -273,10 +269,6 @@ Dropdown.propTypes = {
* To provide custom modifiers to Dropdown component.
*/
dropdownModifiers: PropTypes.array,
/**
* To specify whether the Dropdown should be multilevel.
*/
isMultiLevel: PropTypes.bool,
/**
* <div class="neeto-ui-tag neeto-ui-tag--size-small neeto-ui-tag--style-outline neeto-ui-tag--style-danger mb-2">
* Removed
Expand Down
5 changes: 4 additions & 1 deletion src/components/Tooltip/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ const Tooltip = ({

if (hideAfter > 0) {
localProps["onShow"] = instance =>
setTimeout(() => instance.hide(), hideAfter);
setTimeout(
() => !instance.state?.isDestroyed && instance.hide(),
hideAfter
);
}

useEffect(() => {
Expand Down
4 changes: 2 additions & 2 deletions stories/Components/Dropdown.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ const MultiDropdownWithClickTrigger = args => {

return (
<div className="flex h-80 items-start">
<Dropdown {...args} isMultiLevel label="Dropdown">
<Dropdown {...args} label="Dropdown">
<Menu>
{listItems.map((item, idx) => (
<MenuItem.Button key={idx}>{item}</MenuItem.Button>
Expand Down Expand Up @@ -246,7 +246,7 @@ const MultiDropdownWithHoverTrigger = args => {

return (
<div className="flex h-80 items-start">
<Dropdown {...args} isMultiLevel label="Dropdown">
<Dropdown {...args} label="Dropdown">
<Menu>
{listItems.map((item, idx) => (
<MenuItem.Button key={idx}>{item}</MenuItem.Button>
Expand Down

0 comments on commit b5b1af0

Please sign in to comment.