PubSub.broadcast inside live component ignores topic, calls parent?

Or maybe you can replace live components with live views? Then PubSub would work as expected.


I had a similar (I think) problem with a dashboard consisting of widgets where dashboard was a live view and each widget was a live component.

At first it was working fine but then I decided that I want to fetch the data for each widget asynchronously. I tried calling Task.async in the widget component, then received the response in the dashboard live view’s handle_info and called send_update there as well to update the widget component (they were “stateful” since they also needed to be able to handle some user interactions).

It was a bit complicated, so eventually I just went with making each widget a live view.

1 Like