fix(trading): avoid funding LineChart recreate instance on FundingContainer re-render (#5454)

This commit is contained in:
Bartłomiej Głownia 2023-12-06 11:37:44 +01:00 committed by GitHub
parent 3cd393dac0
commit 41cd6b1455
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,6 +40,9 @@ const DateRange = {
RANGE_ALL: 'All', RANGE_ALL: 'All',
}; };
const priceFormat = (fundingRate: number) =>
`${(fundingRate * 100).toFixed(4)}%`;
export const FundingContainer = ({ marketId }: { marketId: string }) => { export const FundingContainer = ({ marketId }: { marketId: string }) => {
const t = useT(); const t = useT();
const { theme } = useThemeSwitcher(); const { theme } = useThemeSwitcher();
@ -82,7 +85,7 @@ export const FundingContainer = ({ marketId }: { marketId: string }) => {
<LineChart <LineChart
data={values} data={values}
theme={theme} theme={theme}
priceFormat={(fundingRate) => `${(fundingRate * 100).toFixed(4)}%`} priceFormat={priceFormat}
yAxisTickFormat="%" yAxisTickFormat="%"
/> />
); );