# Turbo Stream Broadcast not updating view

**URL:** <https://discuss.hotwired.dev/t/turbo-stream-broadcast-not-updating-view/3806>\
**Category:** General\
**Created:** [February 16, 2022, 12:38pm UTC](https://discuss.hotwired.dev/t/turbo-stream-broadcast-not-updating-view/3806 "2022-02-16T12:38:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phil](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/phil/32/2547_2.png) [@Phil](https://discuss.hotwired.dev/u/Phil)\
**Post date:** [February 16, 2022, 12:38pm UTC](https://discuss.hotwired.dev/t/turbo-stream-broadcast-not-updating-view/3806/1 "2022-02-16T12:38:44Z")

</div>

I have a Turbo Stream which is not updating the view and I’m not sure why. I have two other broadcasts setup in a similar configuration which are working fine.

Everything looks like it should be working from what I can see, I’m just not getting the update on the front end. Am I missing something obvious?

```nohighlight
# partial
<%= turbo_stream_from 'team_players' %>
<div id="players_<%= dom_id(team)%>"
	<% team.players.each do |player| %>
		<%= render player %>
	<% end %>
</div>

```

```ruby
# player model
class Player < ApplicationRecord
belongs_to :team

    after_create_commit do
        broadcast_prepend_to(
            'team_players',
            target: "players_team_#{team.id}",
            locals: { player: self }
        )

    end
end

```

```auto
# server log
Started GET "/cable" for 127.0.0.1 at 2022-02-16 11:45:13 +0000
Started GET "/cable/" [WebSocket] for 127.0.0.1 at 2022-02-16 11:45:13 +0000
Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: keep-alive, Upgrade, HTTP_UPGRADE: websocket)
Turbo::StreamsChannel is transmitting the subscription confirmation
Turbo::StreamsChannel is streaming from team_players

```

```ruby
# console log after manually creating a player for team 9 (exert)
...
 Rendered players/_player.html.erb (Duration: 0.3ms | Allocations: 99)
[ActionCable] Broadcasting to team_players: "<turbo-stream action=\"prepend\" target=\"players_team_9\"><template><div id=\"player_1885\">\n <p>\n <strong>ID:</strong>\n 1885\n </p>\n\n <p>\n <strong>User:</strong>\n 3820748f-d9d3-400e-ac90-6149800a0e68\n </p>\n\n <p>\n <strong>Team:</strong>\n 9\n </p>\n\n <p>\n ...
=> 
#<Player:0x00007fba5fa12568
...

```

Any help or pointers are appreciated!

---

<div class="post-metadata">

**Author:** ![Phil](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/phil/32/2547_2.png) [@Phil](https://discuss.hotwired.dev/u/Phil)\
**Post date:** [February 16, 2022, 12:41pm UTC](https://discuss.hotwired.dev/t/turbo-stream-broadcast-not-updating-view/3806/2 "2022-02-16T12:41:51Z")

</div>

Free internet points are available too! [Rails: Turbo Stream Broadcast not updating view - Stack Overflow](https://stackoverflow.com/questions/71141502/rails-turbo-stream-broadcast-not-updating-view)

---

<div class="post-metadata">

**Author:** ![yunggindigo](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/yunggindigo/32/1271_2.png) [@yunggindigo](https://discuss.hotwired.dev/u/yunggindigo)\
**Post date:** [February 21, 2022, 2:55pm UTC](https://discuss.hotwired.dev/t/turbo-stream-broadcast-not-updating-view/3806/3 "2022-02-21T14:55:31Z")

</div>

One possibility is that their is already the player existing in another team. In this case

```auto
<div id="player_team_1">
  <div id="player_1">
  </div>
</div>

<div id="player_team_2">
</div>

```

if you tried to broadcast the player\_1 to the player\_team\_2 it would find the existing element with the same id in player\_team\_1 and replace it
