Turbo: Turbo silently fails during server-side form validation errors

Created on 9 December 2024, 3 months ago

Problem/Motivation

Basically, if a POST form request does not redirect, Turbo intentionally does not do anything and only logs an error to the console that form submissions must redirect, which completely breaks Drupal providing validation errors. While that behaviour might make sense in Rails apps that use Turbo, this is not how Drupal works so I say we patch Turbo to allow no redirect after a POST submit.

Steps to reproduce

Proposed resolution

Turbo does not currently expose a configuration that we can set, but it looks like the FormSubmission class has a constructor parameter that the Navigator class sets to true which we could patch to passing false.

This would need some testing to make sure it doesn't introduce new issues, but hopefully it'll just fix this.

Remaining tasks

See above.

User interface changes

Drupal validation errors and other non-redirects in response to POST submits should now work.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇨🇦Canada ambient.impact Toronto

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024