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

This commit is contained in:
Bartłomiej Głownia
2023-12-06 10:37:44 +00:00
committed by GitHub
parent 3cd393dac0
commit 41cd6b1455
@@ -40,6 +40,9 @@ const DateRange = {
RANGE_ALL: 'All',
};
const priceFormat = (fundingRate: number) =>
`${(fundingRate * 100).toFixed(4)}%`;
export const FundingContainer = ({ marketId }: { marketId: string }) => {
const t = useT();
const { theme } = useThemeSwitcher();
@@ -82,7 +85,7 @@ export const FundingContainer = ({ marketId }: { marketId: string }) => {
<LineChart
data={values}
theme={theme}
priceFormat={(fundingRate) => `${(fundingRate * 100).toFixed(4)}%`}
priceFormat={priceFormat}
yAxisTickFormat="%"
/>
);