-
-
Notifications
You must be signed in to change notification settings - Fork 523
Closed
Description
Describe the bug
When using useQuery
outside of setup, the following error is produced:
[Vue warn]: onServerPrefetch is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.
To Reproduce
Make a query outside of setup:
provideApolloClient(apolloClient);
const { result } = useQuery(...)
Expected behavior
Ideally, the warning shouldn't be produced, or there should be a way of disabling server prefetching if we're not using SSR
Versions
vue: ^3.2.25
vue-apollo: ^4.0.0-alpha.16
@apollo/client: ^3.5.8
Additional context
Line that produces the error: https://github.com/vuejs/apollo/blob/v4/packages/vue-apollo-composable/src/useQuery.ts#L174
Juliencd and Joaveinz
Metadata
Metadata
Assignees
Labels
No labels