Fail fast if DataSourceRendererVirtual references an non-existent value
Reviewed By: ivanmisuno Differential Revision: D44417205 fbshipit-source-id: 043b3b12ea44d85f1fb02e2cf030b4c9cc7e5087
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ea92388b09
commit
09f7bcf878
@@ -302,6 +302,16 @@ export const DataSourceRendererVirtual: <T extends object, C>(
|
|||||||
tabIndex={0}>
|
tabIndex={0}>
|
||||||
{virtualizer.virtualItems.map((virtualRow) => {
|
{virtualizer.virtualItems.map((virtualRow) => {
|
||||||
const value = dataView.get(virtualRow.index);
|
const value = dataView.get(virtualRow.index);
|
||||||
|
|
||||||
|
if (value === undefined) {
|
||||||
|
console.error(
|
||||||
|
`DataSourceRendererVirtual -> unexpected out-of-bound value. Data view has ${dataView.size} items. Requested ${virtualRow.index}. Virtuaslizer has ${virtualizer.virtualItems.length} items.`,
|
||||||
|
);
|
||||||
|
throw new Error(
|
||||||
|
`DataSourceRendererVirtual -> unexpected out-of-bound value. Data view has ${dataView.size} items. Requested ${virtualRow.index}. Virtuaslizer has ${virtualizer.virtualItems.length} items.`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// the position properties always change, so they are not part of the TableRow to avoid invalidating the memoized render always.
|
// the position properties always change, so they are not part of the TableRow to avoid invalidating the memoized render always.
|
||||||
// Also all row containers are renderd as part of same component to have 'less react' framework code in between*/}
|
// Also all row containers are renderd as part of same component to have 'less react' framework code in between*/}
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user