Skip to content

Commit 87dbb74

Browse files
sookmaxLFDanLu
andauthored
add row undefine-checks in GridLayout (#5737)
Co-authored-by: Daniel Lu <dl1644@gmail.com>
1 parent 741fb7e commit 87dbb74

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/@react-spectrum/card/src/GridLayout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ export class GridLayout<T> extends BaseLayout<T> {
256256
}
257257

258258
let row = this.collection.rows[indexRowBelow];
259-
return getFirstItem(getChildNodes(row, this.collection))?.key;
259+
return row ? getFirstItem(getChildNodes(row, this.collection))?.key : null;
260260
}
261261

262262
getKeyAbove(key: Key) {
@@ -271,6 +271,6 @@ export class GridLayout<T> extends BaseLayout<T> {
271271
}
272272

273273
let row = this.collection.rows[indexRowAbove];
274-
return getFirstItem(getChildNodes(row, this.collection))?.key;
274+
return row ? getFirstItem(getChildNodes(row, this.collection))?.key : null;
275275
}
276276
}

0 commit comments

Comments
 (0)