Skip to content

Commit

Permalink
Merge pull request #192 from nuxt-modules/process-client
Browse files Browse the repository at this point in the history
  • Loading branch information
Baroshem authored Apr 2, 2024
2 parents 9836b58 + 146b966 commit f841d58
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/content/2.advanced/1.vue-instantsearch.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ onBeforeMount(() => {
})

const { data: algoliaState } = await useAsyncData('algolia-state', async () => {
if (process.server) {
if (import.meta.server) {
const nuxtApp = useNuxtApp();
nuxtApp.$algolia.transporter.requester = (
await import('@algolia/requester-node-http').then(
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/components/AlgoliaDocSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ const importDocSearchAtRuntime = async (): Promise<DocSearchFunc> => {
// @ts-ignore
import(/* webpackChunkName: "docsearch" */ '@docsearch/js'),
// @ts-ignore
process.client && import(/* webpackChunkName: "docsearch" */ '@docsearch/css')
import.meta.client && import(/* webpackChunkName: "docsearch" */ '@docsearch/css')
])
return docsearch.default
Expand Down Expand Up @@ -246,7 +246,7 @@ onMounted(async () => {
await initialize()
})
if (process.client) {
if (import.meta.client) {
watch(props, async () => {
await initialize()
})
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/composables/useAlgoliaSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function useAlgoliaSearch (indexName?: string) {
const result = useState(`${index}-search-result`, () => null)

const search = async ({ query, requestOptions }: SearchParams) => {
if (process.server) {
if (import.meta.server) {
const nuxtApp = useNuxtApp()
if (config.public.algolia.useFetch) {
nuxtApp.$algolia.transporter.requester = (await import("@algolia/requester-fetch").then((lib) => lib.default || lib)).createFetchRequester();
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/composables/useAsyncAlgoliaSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function useAsyncAlgoliaSearch ({ query, requestOptions, indexName,
const algoliaIndex = useAlgoliaInitIndex(index)

const result = await useAsyncData(`${index}-async-search-result-${key ?? ''}`, async () => {
if (process.server) {
if (import.meta.server) {
const nuxtApp = useNuxtApp()
if (config.public.algolia.useFetch) {
nuxtApp.$algolia.transporter.requester = (await import('@algolia/requester-fetch').then((lib) => lib.default || lib)).createFetchRequester();
Expand Down

0 comments on commit f841d58

Please sign in to comment.