For example let’s say i want to implement this flow with autocompletes (like select2):
- pick a department from first autocomplete
- pick a user under that department from second autocomplete (that only shows selected department users)
The autocomplete should be reusable.
The problem here is that this requires some kind of reactive data passing between parent and child. For example:
- a LiveView form is rendered that has two autocomplete LiveView’s: departments and users
- department is changed in departments autocomplete
- parent form would receive this change
- parent passes this change to child users autocomplete
- users autocomplete will filter by selected department.
At the moment there seems to be only one way how parent can pass arguments/parameters to its children it uses:
session, but there is two problems with it:
- It is not private: data goes through client and is publicly readable
- It is not reactive: when the assigns change in parent view that are used in
sessionthere is no mechanics to update them in child.
This could be achieved by custom messaging between the LiveView processes but i think this is such a common pattern and potentially complex to implement that it should be abstracted.
If this makes sense then what are your throughs of how this should be implemented and if similar thing is planned in LiveView itself or should it done in third party libraries?