Skip to content

Commit 3c0e10d

Browse files
authored
fix: add more checks around cached rows (#880)
- there were many assumptions that certain objects/fields were defined and calls on them were being made but it could happen in certain rare case that these row cache fields are actually undefined and that threw errors on our end, so this PR adds more checks before using any of these row cache objects/arrays
1 parent 43b85f5 commit 3c0e10d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

slick.grid.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3981,7 +3981,7 @@ if (typeof Slick === "undefined") {
39813981
function ensureCellNodesInRowsCache(row) {
39823982
const cacheEntry = rowsCache[row];
39833983
if (cacheEntry) {
3984-
if (cacheEntry.cellRenderQueue.length) {
3984+
if (cacheEntry.cellRenderQueue.length && cacheEntry.rowNode && cacheEntry.rowNode.length) {
39853985
const rowNode = cacheEntry.rowNode;
39863986
let children = Array.from(rowNode[0].children);
39873987
if (rowNode.length > 1) {
@@ -4194,20 +4194,28 @@ if (typeof Slick === "undefined") {
41944194
for (var i = 0, ii = rows.length; i < ii; i++) {
41954195
if (( hasFrozenRows ) && ( rows[i] >= actualFrozenRow )) {
41964196
if (hasFrozenColumns()) {
4197+
if (rowsCache && rowsCache.hasOwnProperty(rows[i]) && x.firstChild && xRight.firstChild) {
41974198
rowsCache[rows[i]].rowNode = [x.firstChild, xRight.firstChild];
41984199
_canvasBottomL.appendChild(x.firstChild);
41994200
_canvasBottomR.appendChild(xRight.firstChild);
4201+
}
42004202
} else {
4203+
if (rowsCache && rowsCache.hasOwnProperty(rows[i]) && x.firstChild) {
42014204
rowsCache[rows[i]].rowNode = [x.firstChild];
42024205
_canvasBottomL.appendChild(x.firstChild);
4206+
}
42034207
}
42044208
} else if (hasFrozenColumns()) {
4209+
if (rowsCache && rowsCache.hasOwnProperty(rows[i]) && x.firstChild && xRight.firstChild) {
42054210
rowsCache[rows[i]].rowNode = [x.firstChild, xRight.firstChild];
42064211
_canvasTopL.appendChild(x.firstChild);
42074212
_canvasTopR.appendChild(xRight.firstChild);
4213+
}
42084214
} else {
4215+
if (rowsCache && rowsCache.hasOwnProperty(rows[i]) && x.firstChild) {
42094216
rowsCache[rows[i]].rowNode = [x.firstChild];
42104217
_canvasTopL.appendChild(x.firstChild);
4218+
}
42114219
}
42124220
}
42134221

0 commit comments

Comments
 (0)