Hi!
To make it easier to develop LiveComponents that require information from the current context of the LiveView it would be awesome if the LiveComponent.mount/1
could receive the assigns
from the LiveView
that contains the component.
A real-world example is the need to get the current_user
that one may store in the assigns of the LiveView
Alternative could be to add a second mount/2
where the second argument is the parent socket
or assigns
I know that you can give this as arguments when using <.live_component module={MyLiveComponent} id="myid" current_user={@current_user} />
and this will be params to the update/2
function in the component.
But sometimes you would like to load some assigns in the component only once and not everytime the page has updates that then triggers the update/2
function in the component