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

Account's wishlist: integrate hooks #1042

Merged
merged 41 commits into from
Mar 15, 2023
Merged
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
11b6261
1st attempt at integrating the hooks
vmarta Mar 7, 2023
c862ffe
Fix iterating the `wishLists`
vmarta Mar 7, 2023
3923dc8
1st attempt at handling the qty change
vmarta Mar 7, 2023
0b444d5
Attempt at selective update
vmarta Mar 7, 2023
d72419c
Simplify the UX by not doing this optimistically
vmarta Mar 7, 2023
a82ae6d
Better loading states, and consider empty list
vmarta Mar 7, 2023
fbf6cba
More typescript friendly
vmarta Mar 7, 2023
428c3a3
Add comment
vmarta Mar 7, 2023
6d8d9bb
Clean up
vmarta Mar 8, 2023
a35170d
Some refactoring
vmarta Mar 8, 2023
4dd1661
Merge branch 'feature/integrate-commerce-sdk-react' into hooks-accoun…
vmarta Mar 9, 2023
7fe8af0
Remove debug code
vmarta Mar 9, 2023
dff593a
Add to cart button
vmarta Mar 9, 2023
e51439c
More button click handler
vmarta Mar 10, 2023
5524928
More concise way to selectively update
vmarta Mar 10, 2023
da6129e
Attempt at passing the 1st test
vmarta Mar 10, 2023
7900f52
Merge branch 'feature/integrate-commerce-sdk-react' into hooks-accoun…
vmarta Mar 13, 2023
907401a
Update useCurrentBasket call after merge
vmarta Mar 13, 2023
c6ad3fc
Remove redundant test
vmarta Mar 13, 2023
3de2b35
Update test for the Remove button
vmarta Mar 14, 2023
49eb095
Fix the rest of the tests
vmarta Mar 14, 2023
fa90831
Extract the mocked data
vmarta Mar 14, 2023
20d0c2e
Merge branch 'feature/integrate-commerce-sdk-react' into hooks-accoun…
vmarta Mar 14, 2023
1f307c0
Fix more tests
vmarta Mar 14, 2023
20c2186
Merge branch 'feature/integrate-commerce-sdk-react' into hooks-accoun…
vmarta Mar 14, 2023
a7fad37
PDP: fix broken add-to-wishlist button
vmarta Mar 14, 2023
1bd4a5c
Clarify why we're calling `onClick` twice
vmarta Mar 14, 2023
f5159e2
Small refactoring
vmarta Mar 14, 2023
6bd9593
Consider being undefined
vmarta Mar 14, 2023
3c47cf8
PR feedback
vmarta Mar 14, 2023
487c775
No longer does selective update for the cache
vmarta Mar 14, 2023
438a45c
Decreasing quantity to 0 would auto-remove the item
vmarta Mar 15, 2023
df6e823
PDP: add-to-wishlist now works properly again for product sets
vmarta Mar 15, 2023
3792643
Clean up
vmarta Mar 15, 2023
67c339f
Refactor onClick into 2 separate, clearer events
vmarta Mar 15, 2023
1643906
Update test, after props were updated recently
vmarta Mar 15, 2023
60aecdf
Merge branch 'feature/integrate-commerce-sdk-react' into hooks-accoun…
vmarta Mar 15, 2023
b5c1db5
Back to a 1 prop now, but with a promise instead
vmarta Mar 15, 2023
9fd05e0
Increase jest timeout, since waitFor timeout was increased too
vmarta Mar 15, 2023
c73b2e5
Update the test with mock responses
vmarta Mar 15, 2023
7c6e45e
Merge branch 'feature/integrate-commerce-sdk-react' into hooks-accoun…
vmarta Mar 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clean up
vmarta committed Mar 8, 2023

Verified

This commit was signed with the committer’s verified signature.
vmarta Vincent Marta
commit 6d8d9bb8fa03ad8c2f393c7abfb97289a5fc919e
Original file line number Diff line number Diff line change
@@ -59,7 +59,6 @@ const AccountWishlist = () => {
const {data: customer} = useCurrentCustomer()

const handleActionClicked = (itemId) => {
console.log('--- handleActionClicked')
setWishlistItemLoading(!!itemId)
setSelectedItem(itemId)
}
@@ -98,21 +97,6 @@ const AccountWishlist = () => {
}
}
)

/*
try {
// TODO
await wishlist.updateListItem({
...item,
quantity: parseInt(quantity)
})
} catch {
toast({
title: formatMessage(API_ERROR_MESSAGE),
status: 'error'
})
}
*/
}

const isPageLoading = wishListItems ? isProductsLoading : isWishListLoading
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@ const WishlistPrimaryAction = () => {
}
]
try {
// TODO: this and also in the modal
await basket.addItemToBasket(productItems)
showToast({
title: formatMessage(
Original file line number Diff line number Diff line change
@@ -52,6 +52,7 @@ const WishlistSecondaryButtonGroup = ({productListItemId, onClick = noop}) => {
modalProps.onOpen()
}

// TODO
const handleItemRemove = async () => {
onClick(variant.id)
try {