import { useState, useEffect, useMemo, useRef } from 'react'; import { getGeneratedData, complexScales } from '../data'; import { Gantt } from '../../src/'; import { Button } from '@svar-ui/react-core'; import './GanttPerformance.css'; function RenderTime({ start }){ const [end, setEnd] = useState(null); const [label, setLabel] = useState('') let active = useRef(true); useEffect(() => { if (start && end) { setLabel((end - start)+" ms"); } active.current = true; setTimeout(() => { active.current = false; }, 1000); }, [start, end]); window.__RENDER_METRICS_ENABLED__ = true; useEffect(() => { window.addEventListener('render-metric', (e) => { if (!active.current) return; if (e.detail.label === "chart") { setEnd(new Date()); } }); return () => { delete window.__RENDER_METRICS_ENABLED__ }; }, []); return {label} } const count = 10000; const years = 3; const data = getGeneratedData('', count, years); function GanttPerformance(props) { const { skinSettings } = props; const [start, setStart] = useState(null); return (