Refactored funnel report. Made BarChart more generic.

This commit is contained in:
Mike Cao 2023-05-24 21:40:02 -07:00
parent 050cd2f5d9
commit fb4dd75e18
24 changed files with 327 additions and 367 deletions

View file

@ -1,8 +1,7 @@
import useStore, { createReport } from 'store/reports';
import { useCallback, useEffect, useState } from 'react';
import { useForceUpdate } from 'hooks';
export function useReport(reportId) {
export function useReport(reportId, defaultParameters) {
const [id, setId] = useState(reportId);
const selector = useCallback(state => state[id], [id]);
@ -10,12 +9,11 @@ export function useReport(reportId) {
useEffect(() => {
if (!report) {
setId(createReport().id);
const newReport = createReport(defaultParameters);
setId(newReport.id);
}
}, []);
console.log('USE REPORT', report);
return report;
}