Skip to content

useAlgoliaRecommend for SSR #211

@MickL

Description

@MickL

It seems like useAlgoliaRecommend() is not working on SSR:

<script setup lang="ts">
    const { result, get } = useAlgoliaRecommend<AlgoliaProduct>();
    await get({ ... });
<script>

<template>
   {{ result }}
</template>

I get the error:

(void 0) is not a constructor
    at @algolia/recommend/dist/recommend.esm.browser:226:31
    at new Promise (<anonymous>)

[nuxt] Failed to stringify dev server logs. Received DevalueError: Cannot stringify arbitrary non-POJOs. You can define your own reducer/reviver for rich types following the instructions in https://nuxt.com/docs/api/composables/use-nuxt-app#payload.

For useAlgoliaSearch there is useAlgoliaSearchAsync. Can we have the same for useAlgoliaRecommend()?

Motivation: For SEO purposes I want to display the recommendations right away and not lazy in the browser. For example by use of Sistrix I realized that all my products only have exactly one link referencing it (from the product overview).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions