algolia / instantsearch

⚑️ Libraries for building performant and instant search and recommend experiences with Algolia. Compatible with JavaScript, TypeScript, React and Vue.

Home Page:https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError when using middlewares

oliverbeck-dev opened this issue Β· comments

πŸ› Current behavior

I would like to use middlewares like described here: https://www.algolia.com/doc/api-reference/widgets/middleware/vue/#examples

If I return the subscribe function like

function middleware({ instantSearchInstance }) { return { subscribe() { // Do something when the InstantSearch instance starts. }, } }

`<AisInstantSearch
:middlewares="middleware"

.....`

I get this error in the console:

vue-instantsearch_vue3_es.js?v=5425bfd0:12830 Uncaught TypeError: (n6 || []).filter is not a function

image
  • vue 3.4.21
  • vue instantsearch 4.15.0

πŸ” Steps to reproduce

Live reproduction

code sandbox has a node js error...

πŸ’­ Expected behavior

I expect to not see a javascript error

Package version

vue instantsearch 4.15.0

Operating system

macOS 14.4.1

Browser

1.64.116

Code of Conduct

  • I agree to follow this project's Code of Conduct

sorry, my fault. realised now that the prop "middlewares" on instantSearch expects an array instead of a function