Skip to content

Commit

Permalink
Add temporary patch until solid cable's patch gets merged
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgemanrubia committed Dec 5, 2024
1 parent a52d023 commit cf69d50
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module HotwireSpark::ActionCable::SolidCableWithSafeReloads
private
def broadcast_messages
Rails.application.reloader.wrap do
super
end
end
end
5 changes: 5 additions & 0 deletions lib/hotwire_spark/installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ def install
def configure_middleware
::ActionCable::Server::Base.prepend(HotwireSpark::ActionCable::PersistentCableServer)

# TODO: Temporary patch until this gets merged https://github.com/rails/solid_cable/pull/50
if defined?(::ActionCable::SubscriptionAdapter::SolidCable::Listener)
ActionCable::SubscriptionAdapter::SolidCable::Listener.prepend(HotwireSpark::ActionCable::SolidCableWithSafeReloads)
end

middleware.insert_before ActionDispatch::Executor, HotwireSpark::ActionCable::PersistentCableMiddleware
middleware.use HotwireSpark::Middleware
end
Expand Down

0 comments on commit cf69d50

Please sign in to comment.