Skip to content

[@urql/vue] Cannot use useQuery inside of vue-router guard #3731

@leonidk101

Description

@leonidk101

Describe the bug

The setup: There's a pinia store that is used in a router guard, the store uses useQuery composable from @urql/vue

Because it tried to access vue instance in router guard the app returns the following error:

use* functions may only be called during the `setup()` or other lifecycle hooks.

As far as I can see the error comes from

'use* functions may only be called during the `setup()` or other lifecycle hooks.'

Am I doing something wrong?

Reproduction

https://stackblitz.com/edit/vitejs-vite-kudyigng

Urql version

@urql/vue v1.4.2

Validations

  • I can confirm that this is a bug report, and not a feature request, RFC, question, or discussion, for which GitHub Discussions should be used
  • Read the docs.
  • Follow our Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions