iFixit / react-commerce

A work in progress prototype for iFixit e-commerce functionalities.
https://react-commerce.vercel.app
2 stars 0 forks source link

Show Errors in Cart Drawer #2207

Closed danielcliu-ifixit closed 8 months ago

danielcliu-ifixit commented 8 months ago

Overview

We sometimes can have things error out when trying to update the cart. We would roll back the cart but not change anything, and not tell our user that anything wrong happened. Now we give some visual feedback that there was an error updating the cart in the cart drawer.

QA

When we have an error updating the cart (adding a bad product, product is out of inventory, removing an item and it fails) we now display an error message in the cart drawer. The error message is closable, and also disappears after an alloted time.

Also, the checkout errors also still display as expected.

CC @dhmacs Closes: https://github.com/iFixit/ifixit/issues/51213

vercel[bot] commented 8 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-commerce ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 16, 2024 1:36pm
react-commerce-prod ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 16, 2024 1:36pm
ghost commented 8 months ago
👇 Click on the image for a new way to code review #### [![Review these changes using an interactive CodeSee Map](https://s3.us-east-2.amazonaws.com/maps.codesee.io/images/github/iFixit/react-commerce/2207/37500f23/35ad735724749846bf45962c7ab3ea48efc34535.svg)](https://app.codesee.io/r/reviews?pr=2207&src=https%3A%2F%2Fgithub.com%2FiFixit%2Freact-commerce) #### Legend CodeSee Map legend
github-actions[bot] commented 8 months ago

📦 Next.js Bundle Analysis for @ifixit/commerce-frontend

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

deltuh-vee commented 8 months ago

dev_block ✊ I added a product that didn't have enough stock and the error ended up being overlapped by the Cart icon. CleanShot 2024-01-15 at 15 15 23

Could you also make the error last a little longer? I feel like it goes away really quickly.

danielcliu-ifixit commented 8 months ago

un_dev_block :v:

deltuh-vee commented 8 months ago

QA 🎬

danielcliu-ifixit commented 8 months ago

un_deploy_block :v: comments were addressed.

kthaler commented 8 months ago

QA 💎 - The following error is now displayed in the cart when the item is out of stock Screenshot 2024-01-16 at 11 19 54 AM

deploy_block 🦖 - I am not getting an error when the item goes out of stock right before the user adds an item to their cart. Adding the item to the cart understandably doesn't display an error, since the quantity needs some time to update, but I think there should be an error when the user opens their cart again. EX:

https://github.com/iFixit/react-commerce/assets/145375039/81eff943-3a7b-47bf-88fb-dddce884e1b0

danielcliu-ifixit commented 8 months ago

@kthaler i think this would be another issue, as technically we aren't receiving an error from our cart api. I think this is also a very unlikely edge case where we have manually set our inventory db out of sync with shopify's inventory intentionally and I'm unconvinced we should treat this as a case likely to occur in production.

un_deploy_block :v: