Skip to content

Stimulus Binds Twice on New Page after Redirect to GET Request #629

@rience

Description

@rience

Hi,

I've observed this strange behaviour and I couldn't find information about that in documentation. Stimulus does connect, disconnect and connect again page user is redirected to - depends on what was method used in previous request.

Test scenario

  1. Have controller's action that responds with redirect to new page (the one with Stimulus controller).
  2. Bind this action to GET request - observe in console that Stimulus will connect, disconnect and connect again.
  3. Now change this action to POST - observe that Stimulus will only connect once.

This is in Rails 7 application with Turbo framework. However, I've opted-out of caching there.

You can find application that demonstrates this behaviour here: https://github.com/rience/stimulus-double-bind

Thank you in advance for help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions