When I paste 50k rows of data on handsontable it freezes, if anyone else is going through this problem I made this function which I call inside ‘onBeforePaste’ which resolves it
export const largePaste = (tableRef: MutableRefObject, changes, coords) => {
if (tableRef.current) {
const hot = tableRef.current.__hotInstance as Handsontable;
if (!coords) return;
const rowCount = hot.countRows() - 1;
const difference = rowCount - coords[0].startRow;
hot.batch(() => {
if (changes.length - difference > 0)
hot.alter('insert_row', coords[0].startRow + difference + 1, changes.length - difference);
hot.scrollViewportTo(coords[0].startRow - 1 ?? 0, 0);
});
}
};
If there is a better way of fixing it, I would love to hear. but this batch works great.