Skip to content

useAsyncQuery ignores server: false option and executes during SSR #661

@omnichronous

Description

@omnichronous

Environment

Describe the bug

When passing server: false to useAsyncQuery (internally to useAsyncData), the Apollo client query still executes on server-side (SSR).

Looking at composables.ts, the fn doesn't check import.meta.server, which causes this option to be ignored.

Expected behaviour

Setting server: false should skip the query execution during SSR and only run it on client-side.

Reproduction

// Example composable usage
const { result } = useAsyncQuery({
  query: MY_QUERY,
  variables: {},
  server: false
})

This triggers a request during SSR. It should not.

Additional context

Related issues:

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions