Skip to content

Commit

Permalink
Add condition to effect
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvdm committed Jul 16, 2024
1 parent a7ede06 commit 5c95ea4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions web/src/pages/SuccessPage/SuccessPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ import { MetaTags } from '@redwoodjs/web'
import CheckoutSuccessCell from 'src/components/CheckoutSuccessCell/CheckoutSuccessCell'

const SuccessPage = () => {
const { clearCart } = useStripeCart()
const { clearCart, cart } = useStripeCart()
const { sessionId } = useParams()

// OnMount clear the cart contents
useEffect(() => {
clearCart()
})
if (cart.length > 0) {
clearCart()
}
}, [clearCart, cart])

return (
<>
Expand Down

0 comments on commit 5c95ea4

Please sign in to comment.