Description
I'm not sure if this is a LiveView issue, or a TomSelect issue, or a PetalComponents issue, but I thought I'd post it here to see if you have any insights.
With the following code in a form component:
<.combo_box
label={gettext("Preferred Locations")}
multiple
placeholder="Select locations.."
options={@locations}
field={@form[:preferred_location_ids]}
wrapper_class="md:col-span-2"
/>
It works great, I can use the combobox, update the selected values, validate, save, data gets saved, form keeps new selected values.
However, if I then reload the page (in Firefox only!!), the old values are still populated in the select box.
Navigating away and then back to the form again will clear it up, as will a hard refresh, and adding tom_select_options={%{items: @form[:preferred_location_ids}.value}
(ie. the same thing as TomSelect should be inferring anyway), resolves it.
See attached video - the first refresh is a soft refresh (cmd+R), the second is a hard refresh (shift+cmd+R)
Screen.Recording.2025-02-05.at.3.29.06.PM.mov
(added note - to get the dropdown of the combo box to appear properly I had to remove overflow-hidden
from the box
component - how many dramas is that going to cause me?)