Using Polaris Autocomplete inside the Filters Component

Highlighted
New Member
2 0 0

Hi there, I seem to be having some trouble implementing this, but is there any way to use the Autocomplete as a filter for the Filters component from Polaris?

In my custom app, I followed the documentation on Autocomplete and was able to create text fields that had a list of suggestions (loaded from a GraphQL query). These text fields were separate from the filters, which is why they seem to be working. However, I tried to do the exact same thing to one of my filters and replaced the <TextField> with an <Autocomplete> tag, of course following the other rules for Autocomplete like declaring an <Autocomplete.TextField> element.

Whenever I seem to do this however, the app crashes whenever I click on that particular filter. Looking at the console log, it seems to return an error stating that it couldn't read the `length` value of a null object, but what I couldn't understand was what that object was. The issue was related to something called ComboBox rendering, and I have no idea where that came from. Regarding the list of suggestions that it uses, it should be using the same dataset as my other existing Autocomplete Textfields in the app which were working, so I don't know why it isn't working on the Filters.

Any help or advice that anybody can give is greatly appreciated!

0 Likes