diff --git a/components/mkt/WaterfallModal.tsx b/components/mkt/WaterfallModal.tsx index 61cdb34..ddf31d3 100644 --- a/components/mkt/WaterfallModal.tsx +++ b/components/mkt/WaterfallModal.tsx @@ -11,13 +11,12 @@ interface WaterfallModalProps { } export const WaterfallModal: React.FC = ({ product, includeCOGS, onClose }) => { - if (!product) return null; - const data = useMemo(() => { + if (!product) return []; const metrics = calculateProductMetrics(product, includeCOGS); - + let currentTotal = product.grossSales; - + const steps = [ { name: 'Gross Sales', value: product.grossSales, isTotal: true, color: '#6366f1' }, // Indigo { name: 'PPC', value: -product.ppcSpend, isTotal: false, color: '#ef4444' }, // Rose @@ -67,6 +66,8 @@ export const WaterfallModal: React.FC = ({ product, include })); }, [product, includeCOGS]); + if (!product) return null; + const metrics = calculateProductMetrics(product, includeCOGS); return ( diff --git a/index.tsx b/index.tsx index 6ca5361..0001c9a 100644 --- a/index.tsx +++ b/index.tsx @@ -1,6 +1,7 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import App from './App'; +import ErrorBoundary from './components/ErrorBoundary'; const rootElement = document.getElementById('root'); if (!rootElement) { @@ -10,6 +11,8 @@ if (!rootElement) { const root = ReactDOM.createRoot(rootElement); root.render( - + + + ); \ No newline at end of file