Uncaught TypeError: Cannot read properties of undefined (reading 'connectAutocomplete')

const autocomplete = instantsearch.connectors.connectAutocomplete(
({ indices, refine, widgetParams }, isFirstRendering) => {
const { container, onSelectChange } = widgetParams;

if (isFirstRendering) {
  container.html('<select id="ais-autocomplete"></select>');

  container.find('select').selectize({
    options: [],
    valueField: 'query',
    labelField: 'query',
    highlight: false,
    onType: refine,
    onBlur() {
      refine(this.getValue());
    },
    onChange(value) {
      refine(value);
      onSelectChange({
        query: value,
      });
    },
    score() {
      return () => 1;
    },
    render: {
      option({ query }) {
        return `
          <div class="option">
            ${query}
          </div>
        `;
      },
    },
  });

  return;
}

const [select] = container.find('select');

select.selectize.clearOptions();
indices.forEach(({ results }) => {
  results.hits.forEach(hit => select.selectize.addOption(hit));
});
select.selectize.refreshOptions(select.selectize.isOpen);

}
);

I don’t know how you’re importing InstantSearch, but I assume you are using the snippet for umd instantsearch.connectors. instead of importing via the package, if that’s what you’ve done elsewhere:

import {connectAutocomplete} from 'instantsearch.js/es/connectors'

if that wasn’t the case, please give a reproduction with how you get that error :slight_smile: