Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caching issues with on page reload with Combobox (Firefox only) #397

Open
sevenseacat opened this issue Feb 5, 2025 · 0 comments
Open

Comments

@sevenseacat
Copy link

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?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant