Skip to content

Turbo Stream refresh does not work when responding to a form submission #1173

Closed
@jordinl

Description

@jordinl

I'm using Turbo 8 so I can trigger refreshes.

In one instance I submit a form (POST request) and I want to show a toast and refresh the page.

The page already has a toast container like this

<div data-turbo-permanent="" id="toast-container" class="position-fixed top-0 d-flex flex-column align-items-center">
</div>

When I submit the form, I see the server returns:

<turbo-stream action="update" target="toast-container"><template>
    <div class="toast align-items-center border-0" role="alert" aria-live="assertive" aria-atomic="true"
       data-controller="toast">
    <div class="d-flex alert alert-notice">
      <div class="toast-body">
        Marking 15 payouts ($198.45) as paid.
      </div>
      <button type="button" class="btn-xs btn-close me-1 m-auto alert-link btn-sm" data-bs-dismiss="toast" aria-label="Close"></button>
    </div>
  </div>

</template></turbo-stream>

<turbo-stream request-id="374d19b3-8358-462a-ae9d-0da43c02820b" action="refresh"></turbo-stream>

The toast is correctly shown, but the page is not refreshed.

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