-
Notifications
You must be signed in to change notification settings - Fork 67
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
feat(composables): new total price property for useCartItem composable #168
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
Looks really good, some suggestions left for improvements
await removeCartItem(cartItem.value.id, apiInstance); | ||
refreshCart(); |
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.
cart operation is returning cart, what would you say to do something like this?
await removeCartItem(cartItem.value.id, apiInstance); | |
refreshCart(); | |
const newCart = await removeCartItem(cartItem.value.id, apiInstance); | |
await refreshCart(newCart); |
and then in useCart
async function refreshCart(newCart?: Cart): Promise<Cart> {
if (newCart) {
_storeCart.value = newCart;
return newCart;
}
const result = await getCart(apiInstance);
_storeCart.value = result;
return result;
}
so we can skip additional server request?
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.
good improvement. I will do 🚀
} | ||
|
||
/** | ||
* @deprecated Method is not used anymore and the case should be solved on project level instead due to performance reasons. |
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.
let's add patch changeset entry for that
import { getSmallestThumbnailUrl } from "@shopware-pwa/helpers-next"; | ||
import { LineItem } from "@shopware-pwa/types"; | ||
import { getSmallestThumbnailUrl } from "@shopware-pwa/helpers-next"; | ||
import { LineItem } from "@shopware-pwa/types"; |
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.
script setup components have formatting from the first line without tabs, can you make sure you formatted this file? :)
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.
idk why but I had a prettier as default formatter. Switched back to volar and works good as expected :)
Co-authored-by: Patryk Tomczyk <[email protected]>
Description
closes: #157
Type of change
Screenshots (if applicable)
Additional context