Problem/Motivation

At the time of writing, a redirect causes the turbo:before-render and turbo:render to trigger twice, which causes behaviours to detach, attach, detach, and attach again.

Steps to reproduce

Click a redirect link with the browser dev tools console open, looking at debug messages we have in our JavaScript.

Proposed resolution

Doing a search for "redirect" in the Turbo issues yields a few results that seem to indicate this is a known problem with Turbo and not on our end:

Remaining tasks

Work around it ourselves and/or wait for Turbo to implement a fix.

User interface changes

None other than hopefully no weird breaking due to double detach/attach.

API changes

None.

Data model changes

None.

Comments

Ambient.Impact created an issue. See original summary.

ambient.impact’s picture

ambient.impact’s picture

Title: Turbo: redirects cause double rendering » Turbo: Redirects cause double rendering
ambient.impact’s picture

Assigned: Unassigned » ambient.impact

  • Ambient.Impact committed b928a306 on 2.x
    Issue #3397466: Prevent double rendering due to redirects:
    
    Note that...
ambient.impact’s picture

Assigned: ambient.impact » Unassigned
Status: Active » Fixed

Workaround has been committed and seems to work, so closing for now. We can reopen later if needed to refine it.

  • Ambient.Impact committed 63224835 on 2.x
    Issue #3397466: Double render prevention now excludes POST redirects.
    
ambient.impact’s picture

Status: Fixed » Active

Re-opening because there are still edge cases that need to be fixed.

  • Ambient.Impact committed 47ba67e1 on 2.x
    Issue #3397466: Reworked double render to detect POST and GET forms.
    
ambient.impact’s picture

Status: Active » Fixed

This has been fixed in the above commit and seems to work reliably now. Will re-open if needed later.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.