A redirect doesn't work in user form The project it's in Drupal 8.2

Hello, when a user fill the profile and Save  ( /user/id/edit) the page it's reloaded with the new data in the same url, but I want to redirect the user to /user/id

This code should work:

function custom_user_form_user_form_alter(&amp;$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {

  $form_state-&gt;setRedirect('user.page');
}


But it doesn't work, any idea what's going on?

Thanks
You need to add a new submit handler to the form:

function custom_user_form_user_form_alter(&amp;$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  $form['#submit'][] = 'custom_user_submit_handler';
}


Inside the new submit handler set the redirect:

function custom_user_submit_handler(&amp;$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  $form_state-&gt;setRedirect('user.page');
}