Vue-instantsearch: Event: "ready" or "loading"

Created on 4 Oct 2017  Â·  7Comments  Â·  Source: algolia/vue-instantsearch

Ist there any possibility to listen for an event when the search result is ready or loading?

The only event that I found ist "page-change" when using the pagination.

enhancement new feature question

Most helpful comment

Thanks for the link! I ended up doing the following:

 <ais-index :app-id="xxx" :api-key="xxx" index-name="xxx">
    <ais-event-wrapper>
        // Other Components
    </ais-event-wrapper>
</ais-index>

// AisEventWrapper.vue

<template>
    <div>
        <slot>
        </slot>
    </div>
</template>

<script>
import { Component } from 'vue-instantsearch';
export default {
    mixins: [Component],
    watch: {
        'searchStore._results'(val) {
            // Emit event
        }
    }
}
</script>

All 7 comments

Hey @grund3g, what would you use this for? What would be your ideal use case?

Hi,
e.g. when using masonry layouts where I have to update / recalculate the layout when the search result is ready.

Maybe you can ask the user who has already done this here: https://discourse.algolia.com/t/algolia-instantsearch-vue-with-masonry-js/2215/2

Thanks for the link! I ended up doing the following:

 <ais-index :app-id="xxx" :api-key="xxx" index-name="xxx">
    <ais-event-wrapper>
        // Other Components
    </ais-event-wrapper>
</ais-index>

// AisEventWrapper.vue

<template>
    <div>
        <slot>
        </slot>
    </div>
</template>

<script>
import { Component } from 'vue-instantsearch';
export default {
    mixins: [Component],
    watch: {
        'searchStore._results'(val) {
            // Emit event
        }
    }
}
</script>

That seems like a good solution! I'll close this, but feel free to reopen or open another issue for other things 😄

@grund3g Have you upgraded to v2? I've found that this solution no longer works as well with v2, hoping that maybe you have found another solution.

@intrepidws, could you open a new issue, is this also for masonry?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

VinceG picture VinceG  Â·  6Comments

matthewmnewman picture matthewmnewman  Â·  6Comments

francoischalifour picture francoischalifour  Â·  3Comments

foufrix picture foufrix  Â·  5Comments

alekcarvalho picture alekcarvalho  Â·  3Comments