Skip to content

feat: added fetch requester for ssr reasons#194

Merged
Baroshem merged 1 commit intonuxt-modules:mainfrom
Rigo-m:main
Apr 8, 2024
Merged

feat: added fetch requester for ssr reasons#194
Baroshem merged 1 commit intonuxt-modules:mainfrom
Rigo-m:main

Conversation

@Rigo-m
Copy link
Copy Markdown
Contributor

@Rigo-m Rigo-m commented Apr 2, 2024

Fixes atoms-studio/nuxt-swiftsearch#1

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

useAlgoliaRef exports the esm/browser version of the algoliasearch client.
The browser version uses the browserXHRRequester, which doesn't work in node environments, while the non-esm package works both in client and in server environments because it automatically switches XMLHttpRequester and browserXHRRequester depending on the environment it's called within, and that's why algoliaclient works but useAlgoliaRef does not when passing it to swiftsearch.

Proposed fix is to ubiquitously use the fetch requester, which is a better "futuristic" (more contemporary) approach.

If this works for you I'm going to implement swiftsearch integration after.

@Baroshem
Copy link
Copy Markdown
Collaborator

Baroshem commented Apr 4, 2024

Hey @Rigo-m

Thanks for this PR! I will review it shortly and release it at the end of the week as I am currently off for short holidays

@Baroshem Baroshem merged commit 1ec29ca into nuxt-modules:main Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[@nuxtjs/algolia] Passing searchClient from useAlgoliaRef triggers a 500 error

2 participants