I’m encountering a critical issue with Handsontable (v14.5) when running my Next.js 12 project in production mode. Everything works perfectly in development (npm run dev
), but after building (npm run build
) and starting the project (npm start
), Handsontable crashes with the following error:
framework-4ab4da5df1dd0dac.js:9 TypeError: Cannot read properties of undefined (reading 'topOverlay')
at get topOverlayTrimmingContainer (1096.7ac7798e02087ea0.js:45:113839)
at eR.getWorkspaceHeight (1096.7ac7798e02087ea0.js:45:88033)
at eR.getViewportHeight (1096.7ac7798e02087ea0.js:45:89893)
at eR.createRowsCalculator (1096.7ac7798e02087ea0.js:45:90865)
at eR.createCalculators (1096.7ac7798e02087ea0.js:45:92608)
at el.draw (1096.7ac7798e02087ea0.js:45:15466)
at eq.draw (1096.7ac7798e02087ea0.js:45:31559)
at eJ.draw (1096.7ac7798e02087ea0.js:45:116115)
at iu.render (1096.7ac7798e02087ea0.js:45:120488)
at j.<anonymous> (d93df0d5.c906339055c7ee61.js:1:16532)
Here is my Handsontable setup:
import {
AutoColumnSize,
Autofill,
ContextMenu,
CopyPaste,
DropdownMenu,
Filters,
HiddenRows,
registerPlugin,
} from 'handsontable/plugins'
import {
CheckboxCellType,
NumericCellType,
registerCellType,
} from 'handsontable/cellTypes'
import { HotTable, HotColumn } from '@handsontable/react'
import 'handsontable/dist/handsontable.full.css'
import { data } from './data'
registerCellType(CheckboxCellType);
registerCellType(NumericCellType);
registerPlugin(AutoColumnSize);
registerPlugin(Autofill);
registerPlugin(ContextMenu);
registerPlugin(CopyPaste);
registerPlugin(DropdownMenu);
registerPlugin(Filters);
registerPlugin(HiddenRows);
export default function Grid(props) {
return (
<HotTable
data={data}
colWidths={[140, 126, 192, 100, 100, 90, 90, 110, 97]}
colHeaders={[
'Company name',
'Country',
'Name',
'Sell date',
'Order ID',
'In stock',
'Qty',
'Progress',
'Rating',
]}
dropdownMenu={true}
contextMenu={true}
filters={true}
rowHeaders={true}
manualRowMove={true}
navigableHeaders={true}
autoWrapRow={true}
autoWrapCol={true}
height={363}
licenseKey="non-commercial-and-evaluation"
>
<HotColumn data={1} />
<HotColumn data={2} />
<HotColumn data={3} />
<HotColumn data={5} />
<HotColumn data={6} type="checkbox" className="htCenter" />
<HotColumn data={7} type="numeric" />
<HotColumn data={8} readOnly={true} className="htMiddle" />
<HotColumn data={9} readOnly={true} className="htCenter" />
</HotTable>
);
}
What I’ve Tried:
- Verified that it works fine in development mode (
npm run dev
). - Ensured all plugins and cell types are registered correctly.
- Checked if the error is related to SSR by wrapping Handsontable with
useEffect
, but the issue persists. - Removed unnecessary props to see if any particular setting was causing the crash.
Environment:
- Handsontable version: 14.5
- @handsontable/react version: 14.5
- Next.js version: 12
- Node.js version: 16.x
Has anyone faced a similar issue? Any insights on what might be causing this in production mode?
Thanks in advance!