-
Notifications
You must be signed in to change notification settings - Fork 5
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmitriy-kudelko A couple of comments below.
Additionally:
- Can we also ensure that there are dependent props checks? Like for example for infinite loading, all props need to be given by the user or we throw an error, rather than silently failing it.
- Can we provide a default loader? Coz right now, it just renders empty cells.
- Why are we adding multiple rows at the bottom? Shouldn't we rather add just 1 row and let the user customize if they want to add multiple rows?
src/components/Table.js
Outdated
@@ -260,37 +272,64 @@ export default class Table extends PureComponent { | |||
checkboxRenderer, | |||
idKey, | |||
rowClassName, | |||
rowRenderer: renderer | |||
rowRenderer: renderer, | |||
loadMoreLoaderRowCount, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have way too many loadMore-X
props. Can we rename them to something more meaningful or create an infiniteLoading
prop which is an object and accepts customizations? This seems ugly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my eyes grouping props in an object is a worse stuff because it leads to wasted re-renders since you provide a new object literal each time. This is why they are all namespaced with loadMore
. We can use infiniteLoading
instead. It's just way longer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, that makes sense. Let's keep this for now.
Another thing, why are we asking for a loadMoreTotalCount
? We are assuming we will have a finite list. In case of something like a Twitter timeline, there could be tweets tending to infinity. In that case, it might not always be possible to pass a loadMoreTotalCount
.
I think in the table, we would be better off just firing the loadMore
call whenever the scroll reaches bottom, and let the user handle it in their callback.
What say?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are assuming we will have a finite list.
So here I followed existing use cases of how we use react-virtualized infinite loader on Email Logs/Campaigns pages where we exactly know the total number of rows in the database. In fact this is how most of infinite loaders implemented (including react virtualized InfiniteLoader)
src/components/Table.js
Outdated
isChecked, | ||
rowIndex, | ||
renderer, | ||
loadMoreCellRenderer, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, can we use a better name than loadMore-X
?
@samrith-s regarding the main review comment...
|
|
@samrith-s , please verify. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmitriy-kudelko Everything looks good!
Regarding this comment #14 (comment), I'll create a separate issue for it. We can pick it up later.
This adds basic implementation of infinite loading functionality. We might want to improve the logic to determine when
loadMoreRows
callback should be invoked. But for now let's proceed with this naive implementation.