LiveView uploads with AshPhoenix.Form
Hello,
I've got a form that allows the user to select from a few example images, or to upload their own and use that.
Right now it's a set of radio buttons plus a live_file_input. I've gotten it ~working but it feels pretty dirty and hacky with some showstopping bugs so I'm looking for prior art and best practices when it comes to the Ash Way to do live uploads.
I've searched here and it doesn't look like there's a specific upload extension or type yet, but in the meantime, is there a better or recommended way to do what I'm trying to do?
Specifically this:
This feels like sin to me. The liveview file upload examples have you patching params but I don't have params, I have an AshPhoenix.Form.
One bug example: If I change the image, save, and then change it back to what it originally was, it looks like it persists but actually doesn't. I suspect this may have something to do with how I'm setting the
my index.ex: https://gitlab.com/avoh-labs/panacea/-/blob/main/lib/panacea_web/live/rosegarden/configuration_live/index.ex
my index.html.heex: https://gitlab.com/avoh-labs/panacea/-/blob/main/lib/panacea_web/live/rosegarden/configuration_live/index.html.heex#L597
Thank you. Posting here is always clarifying. chasing down some more threads now.
I've got a form that allows the user to select from a few example images, or to upload their own and use that.
Right now it's a set of radio buttons plus a live_file_input. I've gotten it ~working but it feels pretty dirty and hacky with some showstopping bugs so I'm looking for prior art and best practices when it comes to the Ash Way to do live uploads.
I've searched here and it doesn't look like there's a specific upload extension or type yet, but in the meantime, is there a better or recommended way to do what I'm trying to do?
Specifically this:
This feels like sin to me. The liveview file upload examples have you patching params but I don't have params, I have an AshPhoenix.Form.
One bug example: If I change the image, save, and then change it back to what it originally was, it looks like it persists but actually doesn't. I suspect this may have something to do with how I'm setting the
checked attribute?my index.ex: https://gitlab.com/avoh-labs/panacea/-/blob/main/lib/panacea_web/live/rosegarden/configuration_live/index.ex
my index.html.heex: https://gitlab.com/avoh-labs/panacea/-/blob/main/lib/panacea_web/live/rosegarden/configuration_live/index.html.heex#L597
Thank you. Posting here is always clarifying. chasing down some more threads now.
prepare_source maybe
