Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added fetch requester for ssr reasons #194

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

Rigo-m
Copy link
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
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
4 checks passed
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