Fix NPE in DataTable
Summary: Fixed linked NPE. Couldn't find a clear reproduction, Reviewed By: passy Differential Revision: D28958704 fbshipit-source-id: e09830fbad08bf035c54049451de7f52485cb9dc
This commit is contained in:
committed by
Facebook GitHub Bot
parent
f3f0756da7
commit
e6495be902
@@ -238,7 +238,12 @@ export function DataTable<T extends object>(
|
||||
let handled = true;
|
||||
const shiftPressed = e.shiftKey;
|
||||
const outputSize = dataSource.view.size;
|
||||
const windowSize = virtualizerRef.current!.virtualItems.length;
|
||||
const windowSize = props.scrollable
|
||||
? virtualizerRef.current?.virtualItems.length ?? 0
|
||||
: dataSource.view.size;
|
||||
if (!windowSize) {
|
||||
return;
|
||||
}
|
||||
switch (e.key) {
|
||||
case 'ArrowUp':
|
||||
tableManager.selectItem(
|
||||
@@ -282,7 +287,7 @@ export function DataTable<T extends object>(
|
||||
e.preventDefault();
|
||||
}
|
||||
},
|
||||
[dataSource, tableManager],
|
||||
[dataSource, tableManager, props.scrollable],
|
||||
);
|
||||
|
||||
const [debouncedSetFilter] = useState(() => {
|
||||
|
||||
Reference in New Issue
Block a user