Prevent data from being resent after reload - Contact form

hello,
i use the contact form like in the cookbook Email contact form | Kirby CMS.

If the user reloads the page or comes back to the page, the data will be sent again.

If I don’t send the user after the successful send to another page - what can I do to prevent the data from being sent again? How to unset $data after send.

controller - Works without resending

// no exception occurred, let's send a success message
if (empty($alert) === true) {
go(some page');
}

controller - resends data

// no exception occurred, let's send a success message
if (empty($alert) === true) {
$success = 'Your message has been sent, thank you. We will get back to you soon!';
$data = [];
}

Thank you!

The standard way of handling this is via the so called post-redirect-get pattern, i.e. you redirect after successful execution.