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
- vue 3.4.21
- vue instantsearch 4.15.0
π Steps to reproduce
- create a function like https://www.algolia.com/doc/api-reference/widgets/middleware/vue/#examples
- add to the instant search instance
- reload page
- open console
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