Why setting onFormSubmit prevents calling onFormSubmitted?

Setting the onFormSubmit callback, prevents

1) Redirection, if configured in Hubspot

2) Following events, like onFormSubmitted

I tried multiple times, I tried returning true, etc.

onFormSubmit: (form: any) => { setFormSubmitted(true); setFormData( ... )}

Issue was that the setState for formSubmitted actually made React to unmount the form. So the rest of the callback were erroring I guess and execution stopped.

This could be used to prevent the redirection set in the form config itself, but idk which side effects it would have