Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid showing "No items found" stats in <ItemsList /> #559

Merged
merged 6 commits into from
Sep 10, 2023

Conversation

roberto-morado
Copy link
Contributor

fixes #472

@iuioiua this is as simple as I got, without being too intrusive; I personally like it; the problem was a bug regarding the state change of the variable isLoadingSig, I was able to avoid it by initializing the variable as undefined and bypassing it with the conditional rendering not sure if is worth taking another look at it some other time.

Note: The simplicity of this PR does not reflect at all the time that took me to get there — just for the record.

Comment on lines 80 to 93
{isLoadingSig.value !== undefined && !isLoadingSig.value
? itemsSig.value.length > 0
? itemsSig.value.map((item, id) => {
return (
<ItemSummary
key={item.id}
item={item}
isVoted={itemsAreVotedSig.value[id]}
isSignedIn={props.isSignedIn}
/>
);
})
: <EmptyItemsList />
: "█"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make this a little more readable, please? I think we should avoid nesting ternary operators.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing

@iuioiua iuioiua changed the title Avoid showing 'No items found' fix: avoid showing "No items found" stats in <ItemsList /> Sep 10, 2023
@roberto-morado
Copy link
Contributor Author

@iuioiua man! how right you were. This reads way better.

@roberto-morado
Copy link
Contributor Author

After seeing this PR I cannot help but wonder what was I doing this whole time? 🤔

Copy link
Contributor

@iuioiua iuioiua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made a couple of tweaks, and now LGTM. Thank you.

@iuioiua iuioiua merged commit 3a193e1 into denoland:main Sep 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

todo: avoid showing "No items found" state on home and user page
2 participants