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

only cancel loading when user clicked on a different card than the one that has its detail shown #150

Merged
merged 1 commit into from
Oct 11, 2021

Conversation

chomosuke
Copy link
Owner

@chomosuke chomosuke added the bug Something isn't working label Oct 9, 2021
@chomosuke chomosuke self-assigned this Oct 9, 2021
@shangzhel shangzhel added this to the Sprint 3 milestone Oct 9, 2021
Copy link
Collaborator

@shangzhel shangzhel left a comment

Choose a reason for hiding this comment

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

Call cancelLoading inside showCardDetail instead of passing a detailId prop unnecessarily. Terminating the image worker should not be a concern of the Card component.

showCardDetail(card: ICard | null) {
if (userState == null) throw new Error('userState is nullish');
if (card == null) {
setDetail(null);
} else {
const base = userState.cards.find((existing) => existing.id === card.id);
if (base == null) throw new Error('Not found');
setDetail({
base,
overrides: {},
});
}
},

@chomosuke chomosuke merged commit 6aeb99b into master Oct 11, 2021
@chomosuke chomosuke deleted the richard/fixSameCardLoading branch October 11, 2021 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Click on the same card while image is loading and the loading 3 circles stay there forever
2 participants