I have a situation where the left navigation of my application needs to subscribe (PubSub) to updates in the system and re-render. Since this navigation is on every page, what seems like the most realistic approach is to make the left navigation a child LiveView with live_render
- since I don’t want every page/LiveView needing to handle these messages.
The problem however is I can’t figure out how to get the url or @live_action (for setting the active page class) to this child LiveView. The things I’ve tried but have failed due to:
- Child LiveViews can’t
handle_params
. - Child LiveViews @live_action is always
nil
- Child LiveViews can’t read connect_params
- Child LiveViews can only be passed data through the session which is only set once at mount (so doesn’t update when navigating)
Am I stuck just making this left nav a component and maybe use
ing the handle_info
callback in to each LiveView? Am I going about this completely wrong?