isRowLoaded property - confusing name and documentation
See original GitHub issueisRowLoaded
property used by InfiniteLoader
to detect which rows was already requested, to avoid multiple call loadMoreRows
. So it should be called isRowRequested
?
Example in ifiniteloader documentation pretty confused https://github.com/bvaughn/react-virtualized/blob/master/docs/InfiniteLoader.md#examples
function isRowLoaded ({ index }) {
return !!list[index];
}
function loadMoreRows ({ startIndex, stopIndex }) {
return fetch(`path/to/api?startIndex=${startIndex}&stopIndex=${stopIndex}`)
.then(response => {
// Store response data in list...
})
}
It looks like you need just “Store response data in list…” but if you’ll do like that you will get the issue with multiple calls of LoadMoreRows because of response delay.
But in the code example this point is pretty clear https://github.com/bvaughn/react-virtualized/blob/master/source/InfiniteLoader/InfiniteLoader.example.js#L111
It took me a long time before I discovered the problem, maybe I have a problem understanding, but mentioning these points would help me a lot and save time. Thank You.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:5 (2 by maintainers)
Top GitHub Comments
thanks for pointing out it @VladimirPal , i’m confusing about why
loadMoreRows
called multiple with overlapped rangeisRowLoadingOrLoaded
orshouldRequestRow
are the only 100% clear names for the property, since the user code may later decide to unload rows if the user scrolls too far (and should – loading rows until the browser runs out of memory is not responsible programming).isRowRequested
is too vague about the difference between a) if the row has ever been requested, but was later unloaded, and b) the row is actually currently loading or loaded.