Skip to content

Commit

Permalink
Guard against incomplete cell measurement
Browse files Browse the repository at this point in the history
  • Loading branch information
trxcllnt committed Jan 27, 2019
1 parent 32f3259 commit a9c2ae7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions source/Grid/utils/CellSizeAndPositionManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,13 @@ export default class CellSizeAndPositionManager {
return nearestCellIndex;
}
nearestCellIndex = vector.indexOf(targetOffset);
// Guard in case `getSizeAndPositionOfCell` didn't fully measure to
// the nearestCellIndex. This might happen scrolling quickly down
// and back up on large lists -- possible race with React or DOM?
if (nearestCellIndex === -1) {
nearestCellIndex = this._lastMeasuredIndex;
this._lastMeasuredIndex = nearestCellIndex - 1;
}
}

return nearestCellIndex;
Expand Down

0 comments on commit a9c2ae7

Please sign in to comment.