Preprocessing values for inputs in a Phoenix (LiveView) form

Huh… (coughing, trying to hide the embarrassment)… :face_with_open_eyes_and_hand_over_mouth: The field in question is in has_many collection’s items, where at least one is required to be present. On editing existing records, there should be only valid items inside that collection but for the LiveView render of edit I was adding an empty (hence invalid) one, as if the whole record was new rather than existing/validated/persisted. This was obviously causing all the “weird”, while in fact completely correct, behaviour I mentioned above.