Skip to content

Commit

Permalink
fix: Typography dead loop (ant-design#50688)
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ authored Sep 3, 2024
1 parent afabec6 commit 71533ff
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion BUG_VERSIONS.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,6 @@
">= 5.16.0 <= 5.16.1": ["https://github.com/ant-design/ant-design/issues/48200"],
"5.16.3": ["https://github.com/ant-design/ant-design/issues/48568"],
"5.17.1": ["https://github.com/ant-design/ant-design/issues/48913"],
"5.18.2": ["https://github.com/ant-design/ant-design/pull/49487"]
"5.18.2": ["https://github.com/ant-design/ant-design/pull/49487"],
"5.20.4": ["https://github.com/ant-design/ant-design/issues/50687"]
}
11 changes: 11 additions & 0 deletions components/typography/__tests__/ellipsis.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -633,4 +633,15 @@ describe('Typography.Ellipsis', () => {
rerender(renderDemo(true));
expect(container.querySelector('.ant-typography-collapse')).toBeTruthy();
});

it('no dead loop', () => {
const tooltipObj: any = {};
tooltipObj.loop = tooltipObj;

render(
<Base ellipsis={{ tooltip: tooltipObj }} component="p">
{fullStr}
</Base>,
);
});
});
2 changes: 1 addition & 1 deletion components/typography/hooks/useTooltipProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ const useTooltipProps = (
return { title: editConfigText ?? children, ...tooltip };
}
return { title: tooltip };
}, [typeof tooltip === 'object' ? JSON.stringify(tooltip) : tooltip, editConfigText, children]);
}, [tooltip, editConfigText, children]);

export default useTooltipProps;

0 comments on commit 71533ff

Please sign in to comment.