1

Running Rails 7.0.4 and trying to get a basic turbo_stream_from implemented. According to logs, it's broadcasting/transmitting appropriately, but the view itself is not updating.

My issue appears to be identical to this question, but the solution with Redis not being running/installed is not my issue (Redis is properly installed and running).

Have restarted the app, console and redis a dozen times.

# show.html.erb
<%= turbo_stream_from "documents" %>
# document.rb
class Document < ApplicationRecord
  after_update_commit -> { broadcast_update_to "documents", partial: "documents/summary", locals: { document: self }, target: "document_#{self.id}" }
end
# documents/_summary.html.erb
<p class="mb-3 text-sm text-slate-500"><%= pluralize(time_to_read(document.summary), "minute") %> &bull; <%= word_count(document.summary) %> words</p>
<%= markdown document.summary %>
irb(main):004:0> document.touch
  TRANSACTION (0.6ms)  BEGIN
  Document Update (1.9ms)  UPDATE "documents" SET "updated_at" = $1 WHERE "documents"."id" = $2  [["updated_at", "2023-01-07 18:24:21.823597"], ["id", "05feddd8-2fb7-4432-9eda-7db07616d613"]]
  TRANSACTION (0.3ms)  COMMIT
  Rendered documents/_summary.html.erb (Duration: 0.6ms | Allocations: 96)
[ActionCable] Broadcasting to documents: "<turbo-stream action=\"append\" target=\"document_05feddd8-2fb7-4432-9eda-7db07616d613\"><template><p class=\"mb-3 text-sm text-slate-500\">1 minute &bull; 38 words</p>\n<p>-The study of a 2,000-year-old city wall made of concrete reveals the sustainability of the Roman&#39;s use of quicklime i...
=> true
12:24:55 web.1    | Started GET "/cable" [WebSocket] for ::1 at 2023-01-07 12:24:55 -0600
12:24:55 web.1    | Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket)
12:24:55 web.1    | Turbo::StreamsChannel is transmitting the subscription confirmation
12:24:55 web.1    | Turbo::StreamsChannel is streaming from documents
12:25:17 web.1    | Turbo::StreamsChannel transmitting "<turbo-stream action=\"append\" target=\"document_05feddd8-2fb7-4432-9eda-7db07616d613\"><template><p class=\"mb-3 text-sm text-slate-500\">1 minute &bull; 38 words</p>\n<p>-The study of a 2,000-year-old city wall made of concrete reveals the sustainability of the Roman&#39;s use of quicklime in... (via streamed from documents)

This is what I see on the rendered page:

<turbo-cable-stream-source channel="Turbo::StreamsChannel" signed-stream-name="ImRvY3VtZW50cyI=--a3f0177252c55b1545ca8ef5c030cc9ed23496182d09168cd9ef3441d9510d22"></turbo-cable-stream-source>
Shpigford
  • 24,748
  • 58
  • 163
  • 252
  • `target="document_05feddd8-2fb7-4432-9eda-7db07616d613"` this target needs to be on the page for turbo stream to update it. – Alex Jan 08 '23 at 01:42

0 Answers0