Skip to content

ClearCart not clearing on success page in NextJS 13.4.9 app folder. #340

Open
@graemec23

Description

I have a weird bug, I cant get the Cart to clear on the success page after returning from stripe.

If I click on another page, then return to the success page the cart clears. Its just when I come to that page from stripe, or copy / paste the url into a browser. The clearCart function is wrapped in a useEffect like below, and is in a 'use client' component.

useEffect(() => { clearCart(); }, []);

I have found if I wrap the clearCart in a setTimeout it works, but this feels like bit of a hack. Has anyone else had this issue?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions