After some weird behavior on some breads I found out using a Proxy that every POST request is always triggered twice for some reason. For most scenario that does not matter but in some cases it duplicates data or execute the logic two times.



The difference is that the first it has the header X-Requested-With: XMLHttpRequest and the response is 200. The second time is executed it does not have X-Requested-With: XMLHttpRequest and the response is 302 but sometimes is 200 also.
Sounds like we have some JS that might need "PreventDefault".... @tnylea, it sounds like a JS change, mind seeing if you can track it down?
First request is a checking your form has a validation errors, if has you will get a message with your fields errors(first request), if doesn't have errors form is unbind from submit and submiting form without errors to controller(second request). This is not saving twice your bread, just first request is checking for your form has validations errors.
Got it. I was missing if (!$request->ajax()) in my custom controller to ignore the validation call.
This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.
Most helpful comment
Got it. I was missing if (!$request->ajax()) in my custom controller to ignore the validation call.