Skip to content

Disable morphing per page #549

Open
@morgoth

Description

@morgoth

Currently when setting turbo_refreshes_with(method: :morph, scroll: :preserve) in layout, it is set globally.

It's not easy to opt out of morphing on some single page. Duplicating meta tags via:

<% content_for(:head) do %>
  <%= turbo_refreshes_with(method: :replace, scroll: :reset) %>
<% end %>

does not work.

Even such combo doesn't work:
<%= content_for?(:morphing) ? yield(:morphing) : turbo_refreshes_with(method: :morph, scroll: :preserve) %>

<% content_for(:morphing) do %>
  <%= turbo_refreshes_with(method: :replace, scroll: :reset) %>
<% end %>

as the meta tags are cached between page navigation, so they cannot be overwritten this way.

Is there a nice way to do it? Maybe created meta tags should be marked with "data-turbo-track": "reload" so it's easier to change them between pages?

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