mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 11:45:23 +02:00
fix: resolve maximum call stack size exceeded error and optimize master table
This commit is contained in:
@@ -596,9 +596,10 @@ const App: React.FC = () => {
|
||||
const gridContext = useMemo(() => {
|
||||
if (rawData.length === 0) return { minWeek: 1, maxWeek: 53, currentYear: new Date().getFullYear() };
|
||||
|
||||
const currentYear = Math.max(...rawData.map(r => r.year));
|
||||
const currentYear = rawData.reduce((max, r) => Math.max(max, r.year), 0);
|
||||
const currentYearData = rawData.filter(r => r.year === currentYear);
|
||||
const maxWeek = Math.max(...currentYearData.map(r => r.week).filter(Boolean));
|
||||
const maxWeek = currentYearData.map(r => r.week).filter((w): w is number => w !== undefined)
|
||||
.reduce((max, w) => Math.max(max, w), 0);
|
||||
|
||||
return { minWeek: 1, maxWeek: maxWeek || 53, currentYear };
|
||||
}, [rawData]);
|
||||
|
||||
Reference in New Issue
Block a user