fix: Typography dead loop (#50688)

This commit is contained in:
二货爱吃白萝卜 2024-09-03 16:20:44 +08:00 committed by GitHub
parent afabec60c3
commit 71533ff2a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 2 deletions

View File

@ -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"]
}

View File

@ -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>,
);
});
});

View File

@ -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;