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

Error in Add to Cart and Edit Cart Form #1323

Open
osseonews opened this issue Apr 14, 2024 · 1 comment
Open

Error in Add to Cart and Edit Cart Form #1323

osseonews opened this issue Apr 14, 2024 · 1 comment

Comments

@osseonews
Copy link

If you inspect the console for the cart, in the Edit Item area (in the cart modal) or the Add to Cart (on product page) before you take any action, you will see the error below in the form action. This error is being caused by the file, edit-item-quantity-button.tsx or in the Add to Cart component. This error with Forms is discussed here in this issue: vercel/next.js#56234. The form action still works on submit, so maybe this is a "false" error of sorts and can be safely ignored? Or maybe there is some code that can be fixed to prevent this error? The strange thing is that the SubmitButton uses e.preventDefault(), so not sure why the form is firing in React on page load. It does seem to be some bug related to useFormStatus.

javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')
@osseonews
Copy link
Author

BTW, here is a screenshot showing the error on Vercel's own demo store on a product page on initial load. The same happens in the cart modal page.
screen-error-form

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant