Skip to content

Commit

Permalink
add episode_id to component_id
Browse files Browse the repository at this point in the history
  • Loading branch information
sorax committed Sep 4, 2024
1 parent ed4af79 commit 4f5c61d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion lib/radiator_web/live/episode_live/index.ex
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ defmodule RadiatorWeb.EpisodeLive.Index do
def handle_info(%NodeDeletedEvent{} = event, socket), do: proxy_event(event, socket)

defp proxy_event(event, socket) do
send_update(RadiatorWeb.OutlineComponent, id: "outline", event: event)
send_update(RadiatorWeb.OutlineComponent,
id: "outline-#{socket.assigns.selected_episode.id}",
event: event
)

socket
|> stream_event(event)
Expand Down
2 changes: 1 addition & 1 deletion lib/radiator_web/live/episode_live/index.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
</.header>

<.live_component
id="outline"
id={"outline-#{@selected_episode.id}"}
module={RadiatorWeb.OutlineComponent}
episode_id={@selected_episode.id}
user_id={@current_user.id}
Expand Down
2 changes: 1 addition & 1 deletion lib/radiator_web/live/outline_component.html.heex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div id={@id}>
<OutlineComponents.keyboard_shortcuts />

<div id={[@id, "-stream-#{@episode_id}"]} class="my-6" phx-hook="outline" phx-update="stream">
<div id={[@id, "-stream"]} class="my-6" phx-hook="outline" phx-update="stream">
<div
:for={{id, form} <- @streams.nodes}
id={id}
Expand Down

0 comments on commit 4f5c61d

Please sign in to comment.