I have a LiveView page like above picture.
I try to click on checklist and using socket = assign(socket, read_list: read_list) to update partial of the page, but the action reset all other radio button selection to default.
How can I update partial data and don’t need to compose all the data for all the lists?
You have to manage the state of your assigns in such a way that when it re-renders, the default value is the current value on the assigns. Take into account that on every update to the assigns, it will re-render.
When filtering a collection (like your example seems to suggest) I like to make use of query parameters, since this way the link is also shareable. Depending of the context, this might be a desirable feature most of the time.
This means that your handle_event("form_phx_change_action") callback will do a push_patch and you will retrieve the params in handle_params callback and use that to set the form’s state.
I don’t really understand the problem, but you can try make each button a live_component, so each one of them updates itself. And do the updates individually because based on your code you are querying the whole dataset every time.
Yeah, I will try live_component.
Currently the data comes from both Ecto/Postgres and Riak, so don’t want to create a wrapper for both of them, as these two sets of data not tightly coupled.