To populate my live_modal
form I am finding I do a lot of similar setup in the mount/3
of edit.ex
and index.ex
. I pull a few items out of the db, modify the structure a bit to be more accessible to the view, then I put it on the socket, pass it through to the live_modal in both index.leex
and edit.leex
for it to be read by form_component.html.leex
which doesn’t feel very dry.
I could pull this out into some helpers which both mounts call, however I feel like there should be a better way to structure my code and reduce the repetition.