You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After a lot of debugging, realize that engine.websocket.full_mount_path is now /cable, and instead of Lookbook::Cable and Lookbook::Connection it is now ActionCable::Server::Base and ActionCable::Connection::Base.
A simple method for configuring Lookbook's ActionCable::Server::Configuration, documented in the Lookbook documentation. Or, if one exists and is documented elsewhere already, a link to that documentation.
Version numbers
Please complete the following information:
Lookbook: 2.0.2
ViewComponent: 3.0.0
Rails: 6.1.7.3
Ruby: 3.0.6
Additional context
I've never configured ActionCable before, so it's entirely possible I simply overlooked a much simpler approach that was documented and I couldn't find it.
To debug the issue, I used rdbg and something like the following:
Hey @nevans - many thanks for the super-detailed bug report and sorry you are running into frustrations here!
I'm sure that this can be cleaned up a bunch to make it more intuitive. I must admit when I first put it together I didn't at all consider people needing to customise the cable configuration - clearly an oversight. And there is some stuff in there that is a bit of a hangover from older ways of doing things in previous versions so I'm sure this can be improved a lot.
I'll try and take a look at it when I next have a chance - I'm moving house in a couple of days so it may not happen too quickly but if this is causing people headaches it's definitely something I'd like to improve. When I've got something worth looking at I'll open a PR and let you know.
Thanks again for taking the time to explain the issue so thoroughly, much appreciated.
Thanks! This workaround is working for me---so take your time! If anyone else has a similar issue, hopefully this issue and its workaround will be easy to find.
@nevans okay great, glad it's not a blocker for you as I'm pretty time-poor at the moment but I'll let you know as soon as I have something to test out :-)
Describe the bug
Configuring Lookbook's ActionCable (e.g. to add
allowed_request_origins
) is counter-intuitive and difficult to debug.To Reproduce
Steps to reproduce the behavior:
/lookbook/cable
, which helps me realize thatLookbook::Cable
has its own configuration: https://github.com/ViewComponent/lookbook/blob/764cf8f2b44ee559a52fcd69cde1c48967d4803b/lib/lookbook/cable/cable.rb#L44-L51engine.websocket.full_mount_path
is now/cable
, and instead ofLookbook::Cable
andLookbook::Connection
it is nowActionCable::Server::Base
andActionCable::Connection::Base
.Lookbook.engine.websocket
from an initializer calls the following method: https://github.com/ViewComponent/lookbook/blob/764cf8f2b44ee559a52fcd69cde1c48967d4803b/lib/lookbook/engine.rb#L119-L121This is problematic:
mount_path
comes fromconfig/routes.rb
but that loads after the initializers@_websocket
memoizesLookbook::Cable
with an emptyengine_mount_path
Workaround
Place the following line at the bottom of
config/routes.rb
:And place the following into an initializer:
Is there a better approach?
Expected behavior
A simple method for configuring Lookbook's
ActionCable::Server::Configuration
, documented in the Lookbook documentation. Or, if one exists and is documented elsewhere already, a link to that documentation.Version numbers
Please complete the following information:
Additional context
I've never configured ActionCable before, so it's entirely possible I simply overlooked a much simpler approach that was documented and I couldn't find it.
To debug the issue, I used
rdbg
and something like the following:The text was updated successfully, but these errors were encountered: