Skip to content

Patrick/add cart page#11

Merged
patrick-fs merged 8 commits into
masterfrom
patrick/add_cart_page
Mar 30, 2020
Merged

Patrick/add cart page#11
patrick-fs merged 8 commits into
masterfrom
patrick/add_cart_page

Conversation

@patrick-fs
Copy link
Copy Markdown
Member

@patrick-fs patrick-fs commented Mar 27, 2020

This PR adds the view/edit cart page. Please see comment thread for a callout/question for review.

Comment thread src/components/CartItems.tsx Outdated
Comment thread src/store/reducers/cart.ts
Comment thread src/components/CartItems.tsx Outdated
return (
<ListGroup>
{ products.map((product, i) => (
<ListGroup.Item key={i}>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since this list could get resorted (based on the name sort), the key={i} can lead to weirdness:
https://medium.com/@robinpokorny/index-as-a-key-is-an-anti-pattern-e0349aece318

Might be time to create an ID for each product, or, if the title is unique, then use that.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I've used product.id - thanks for the link.

Comment thread src/actions/cart.ts Outdated
Copy link
Copy Markdown
Contributor

@timjchin timjchin left a comment

Choose a reason for hiding this comment

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

LGTM!

@patrick-fs
Copy link
Copy Markdown
Member Author

LGTM!

Hey @van-fs would you please review as well.

Copy link
Copy Markdown
Member

@van-fs van-fs left a comment

Choose a reason for hiding this comment

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

LGTM

@patrick-fs patrick-fs merged commit 4475321 into master Mar 30, 2020
@patrick-fs patrick-fs deleted the patrick/add_cart_page branch March 30, 2020 11:45
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.

3 participants