-
-
Notifications
You must be signed in to change notification settings - Fork 23
Fix no cards loading #73
Conversation
just to abstract over skeleton cards and loading state
|
Looks elegant |
| list={cards} | ||
| renderExists={(list) => ( | ||
| <CardsItemsBlock> | ||
| {list.filter(Boolean).map((card) => |
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.
list.map(card => Boolean(card) && render...
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 this case you will have array with empty elements
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.
Array of false and needed elements, so what?
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.
I think this is eager optimization
| export const SkeletonList = ({ | ||
| isLoading, | ||
| ids, | ||
| count = 3, |
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.
magic numbers. Need to move to named const
| <CardsList | ||
| key={`card-view-${current.id}`} | ||
| ids={[current.id]} | ||
| renderCard={({ card, onUsefulClick }) => ( |
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.
That function can be static (defined in the upper scope)
| }} | ||
| > | ||
| Favorite | ||
| <ZeroTab active={tab === "created"} onClick={() => setTab("created")}> |
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.
All string literals ("useful", "created") must be defined statically in one place and reused by imports for safety feature changes
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.
This is not a final solution. After a redesign, I will return to this code
Closes #69
Closes #68