mirror of
https://github.com/fly-apps/live_beats.git
synced 2024-11-25 09:20:59 +00:00
Use live_redirect/2
instead of internal data attributes
The implementation of `LiveHelpers.link/1` for the `:navigate` case was using data attributes (`data-phx-link` and `data-phx-link-state`) that are internal to the implementation of LiveView's live navigation. This change refactors `link/1` to use the public `LiveView.Helpers.live_redirect/2` to achieve the same behavior.
This commit is contained in:
parent
f1908151f9
commit
a459196cd8
1 changed files with 2 additions and 2 deletions
|
@ -126,9 +126,9 @@ defmodule LiveBeatsWeb.LiveHelpers do
|
||||||
assigns = assign_new(assigns, :class, fn -> nil end)
|
assigns = assign_new(assigns, :class, fn -> nil end)
|
||||||
|
|
||||||
~H"""
|
~H"""
|
||||||
<a href={@navigate} data-phx-link="redirect" data-phx-link-state="push" class={@class}>
|
<%= live_redirect to: @navigate, class: @class do %>
|
||||||
<%= render_slot(@inner_block) %>
|
<%= render_slot(@inner_block) %>
|
||||||
</a>
|
<% end %>
|
||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue