vue-instantsearch
vue-instantsearch copied to clipboard
v2 - use cases for emitting events when refining
Feedback on the v2 alpha version 🆕
Describe the bug / features
There might be some use cases where people want to listen to things happening inside widgets and do side effects. One major use case used to be routing, bu that can be solved in different ways now.
Reproduction
Please for every use case you have, make a sandbox link with https://codesandbox.io/s/zx4y4l9orl with the code you'd like to see working and give some explanation on what you expect to be emitted at which point
What is the version you are using?
Always try the latest one before opening an issue.
v2.0.0-alpha.3
I've had to write a custom component, just to be able to output the number of page results in a location outside of the <ais-instant-search />
Thanks for that use case @drpeck. Which API would be ideal for you if it would exist?
I guess just a change event on the main AIS component, for any changes to the state data changes. The full new state data provided as an argument, and potentially the old state data too if that wasn't too hard.
From: Haroen Viaene [email protected] Sent: Friday, February 8, 2019 3:46:02 PM To: algolia/vue-instantsearch Cc: David Peck; Mention Subject: Re: [algolia/vue-instantsearch] v2 - use cases for emitting events when refining (#552)
Thanks for that use case @drpeckhttps://github.com/drpeck. Which API would be ideal for you if it would exist?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/algolia/vue-instantsearch/issues/552#issuecomment-461845881, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABJAD8sJs6p7UH_a-IFWAlFWX7jF5F1Bks5vLZu6gaJpZM4Xv6Wo.
This was an old issue but i would also be happy to see if the ais-instantsearch compoent can emit the state changes.
What would you do with the event? There's middleware, onStateChange and widgets as well which could already cover your use case
Thank you for replying! Actually later I found my use case a bit different from the current issue. I would like to use the refine
method from the default slot of <ais-autocomplete />
outside that component, even outside <ais-instant-search />
. Also I would like to use the state
of <ais-instant-search >
outside it. I found the method @drpeck provided inspiring, and that's how I was led to this issue. Later I found some other solution e.g., using template ref
with onMounted()
. I am sorry for disrupting the discussion with something irrelevant.
I'd say the low number of replies here indicates we don't need events