Full document, spreadsheet, slideshow, and diagram tooling
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request 'fix(sheets): harden cell data, prevent double-commit, spill bounds' (#213) from fix/sheets-bugs into main

scott f47dd678 9e4f4a4d

+11 -2
+11 -2
src/sheets/main.ts
··· 671 671 return { 672 672 v: cell.get('v') ?? '', 673 673 f: cell.get('f') ?? '', 674 - s: cell.get('s') ? JSON.parse(cell.get('s')) : {}, 674 + s: cell.get('s') ? (() => { try { return JSON.parse(cell.get('s')); } catch { return {}; } })() : {}, 675 675 }; 676 676 } 677 677 return null; ··· 758 758 759 759 spillMap.set(sourceId, { rows, cols, data: arr }); 760 760 761 + const sheet = getActiveSheet(); 762 + const maxRows = sheet.get('rowCount') || 100; 763 + const maxCols = sheet.get('colCount') || 26; 764 + 761 765 for (let r = 0; r < rows; r++) { 762 766 for (let c = 0; c < cols; c++) { 763 767 if (r === 0 && c === 0) continue; 768 + // Bounds check: skip spill targets beyond sheet dimensions 769 + if (ref.row + r > maxRows || ref.col + c > maxCols) continue; 764 770 const targetId = colToLetter(ref.col + c) + (ref.row + r); 765 771 const idx = r * cols + c; 766 772 // Check for collision: target has real data ··· 1645 1651 } 1646 1652 } 1647 1653 1654 + let _commitInProgress = false; 1648 1655 function commitEdit() { 1649 - if (!editingCell) return; 1656 + if (!editingCell || _commitInProgress) return; 1657 + _commitInProgress = true; 1650 1658 const id = cellId(editingCell.col, editingCell.row); 1651 1659 const td = grid.querySelector('td[data-id="' + id + '"]'); 1652 1660 const input = td?.querySelector('.cell-editor'); ··· 1673 1681 clearGridHighlights(); 1674 1682 hideTooltip(); 1675 1683 refreshVisibleCells(); 1684 + _commitInProgress = false; 1676 1685 } 1677 1686 1678 1687 function onEditKeyDown(e) {