Instead of deconstructing the object like this:
const { data, setData, post, processing, errors, reset, setError, recentlySuccessful } = useForm({
name: company.name,
description: company.description,
logo: company.logo,
});
why don't you do this:
const form = useForm({
name: company.name,
description: company.description,
logo: company.logo,
});
and then in onSuccess just use form.recentlySuccessful which as the documentation says it will be true just for 2 seconds:
When a form has been successfully submitted, the wasSuccessful property will be true. In addition to this, forms have a recentlySuccessful property, which will be set to true for two seconds after a successful form submission. This property can be utilized to show temporary success messages.