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,17 +55,14 @@ export default function PageviewsChart({
}, [data]); }, [data]);
return ( return (
<div ref={ref}> <BarChart
<BarChart {...props}
{...props} key={websiteId}
key={websiteId} className={className}
className={className} datasets={datasets}
datasets={datasets} unit={unit}
unit={unit} records={records}
records={records} loading={loading}
animationDuration={visible ? animationDuration : 0} />
loading={loading}
/>
</div>
); );
} }