Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/javascript/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ document.addEventListener("turbo:before-render", (event) => {
prevPath = window.location.pathname;
event.detail.render = async (prevEl, newEl) => {
await new Promise((resolve) => setTimeout(() => resolve(), 0));
morphdom(prevEl, newEl);
morphdom(prevEl, newEl, {
onBeforeElUpdated: (el, _) => !(el.hasAttribute('data-turbo-morph-permanent')),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Имеет смысл ещё добавить проверку на isSameNode.

});
};

if (document.startViewTransition) {
Expand Down
2 changes: 1 addition & 1 deletion app/views/albums/_aside.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%# locals: (album: nil) -%>
<%= turbo_frame_tag :aside, class: "aside", target: "_top", data: {"turbo-permanent" => true}, "transition-name" => "aside" do %>
<%= turbo_frame_tag :aside, class: "aside", target: "_top", data: {"turbo-morph-permanent" => true}, "transition-name" => "aside" do %>
<% next unless album %>
<div transition-id="<%= album.id %>">
<div class="album-info">
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/_player.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%# locals: (track:, station: nil) -%>
<div class="player" id="<%= dom_id(station || track, "player_#{track.id}") %>" data-turbo-permanent>
<div class="player" id="<%= dom_id(station || track, "player_#{track.id}") %>" data-turbo-morph-permanent>
<% if track %>
<div class="player--timeline">
<div class="player--timeline-progress" style="width:11%;"></div>
Expand Down