Hey, guys! Have a question, maybe someone can help me with it.
I have the html select tag on which I initialize selectize.js
. Everything works great except one thing - randomly on load I can see for a 0.1s my original select tag without applied selectize js. Maybe I should changes something in loading or what?
I have such html.erb
code
<%= select_tag :user_companies,
options_for_select(current_user.companies.pluck(:title,:id), current_company.id),
data: {
controller: 'application--select',
action: "application--menu#companyChange",
url: update_current_company_settings_path
} %>
and stimulus controller with such JS
connect() {
let element = this.element;
if ($(`#${element.id}-selectized`).length) {
return;
}
let $selectizeElement = $(element).selectize();
}