mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-19 15:06:20 +00:00
5697d169ee
InfiniteGridRoot called useVirtualizer + 2 useEffect after an early return for the squareItems branch, which violates the rules of hooks (react-hooks v7 now flags this as an error and react-compiler skips the component entirely). Split the component into three: - useColumnMeasure: shared custom hook that owns parentRef + ResizeObserver-based column measurement (used by both branches). - InfiniteGridSquare: the non-virtualized grid for squareItems mode. Doesn't call useVirtualizer. - InfiniteGridVirtualized: the virtualized branch with TanStack Virtual + scroll/padding effects. InfiniteGridRoot becomes a thin selector that routes by props.squareItems. All hooks in each sub-component are now unconditional. The remaining lint findings on this file (set-state-in-effect inside InfiniteGridItem, react-hooks/incompatible-library on useVirtualizer) are pre-existing/informational and out of scope. https://claude.ai/code/session_01GrR87LAqnAEyKG2ZbmQt5Q