Remove visible check.

This commit is contained in:
Mike Cao 2023-04-03 03:12:12 -07:00
parent 31f28125dc
commit 5103da331a

View File

@ -1,8 +1,7 @@
import { useMemo } from 'react'; import { useMemo } from 'react';
import { useVisible } from 'react-basics';
import { colord } from 'colord'; import { colord } from 'colord';
import BarChart from './BarChart'; import BarChart from './BarChart';
import { THEME_COLORS, DEFAULT_ANIMATION_DURATION } from 'lib/constants'; import { THEME_COLORS } from 'lib/constants';
import useTheme from 'hooks/useTheme'; import useTheme from 'hooks/useTheme';
import useMessages from 'hooks/useMessages'; import useMessages from 'hooks/useMessages';
@ -13,12 +12,10 @@ export default function PageviewsChart({
records, records,
className, className,
loading, loading,
animationDuration = DEFAULT_ANIMATION_DURATION,
...props ...props
}) { }) {
const { formatMessage, labels } = useMessages(); const { formatMessage, labels } = useMessages();
const [theme] = useTheme(); const [theme] = useTheme();
const { ref, visible } = useVisible();
const colors = useMemo(() => { const colors = useMemo(() => {
const primaryColor = colord(THEME_COLORS[theme].primary); const primaryColor = colord(THEME_COLORS[theme].primary);
@ -58,7 +55,6 @@ export default function PageviewsChart({
}, [data]); }, [data]);
return ( return (
<div ref={ref}>
<BarChart <BarChart
{...props} {...props}
key={websiteId} key={websiteId}
@ -66,9 +62,7 @@ export default function PageviewsChart({
datasets={datasets} datasets={datasets}
unit={unit} unit={unit}
records={records} records={records}
animationDuration={visible ? animationDuration : 0}
loading={loading} loading={loading}
/> />
</div>
); );
} }