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

fix(vue): Fix regression causing variables to not be reactive #3605

Merged
merged 1 commit into from
Jun 6, 2024

Conversation

yurks
Copy link
Contributor

@yurks yurks commented Jun 6, 2024

Summary

Restore reactivity typings for variables input.

This regression caused a number of issues using graphql-code-generator

Set of changes

Reuse MaybeRef type for variables typing.

Copy link

changeset-bot bot commented Jun 6, 2024

⚠️ No Changeset found

Latest commit: d5bd931

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@yurks yurks changed the title Fix regression causing variables to not be reactive fix(vue): Fix regression causing variables to not be reactive Jun 6, 2024
@JoviDeCroock JoviDeCroock merged commit d07602d into urql-graphql:main Jun 6, 2024
11 checks passed
@JoviDeCroock
Copy link
Collaborator

JoviDeCroock commented Jun 6, 2024

Darn I missed that this doesn't have a changeset, do you mind adding one or should I? More info here or the bot comment above

@yurks
Copy link
Contributor Author

yurks commented Jun 6, 2024

Darn I missed that this doesn't have a changeset, do you mind adding one or should I? More info here or the bot comment above

thanks, will do within another PR

JoviDeCroock added a commit that referenced this pull request Jun 7, 2024
@JoviDeCroock
Copy link
Collaborator

Pushed a changeset so I can add it to a release @yurks

@github-actions github-actions bot mentioned this pull request Jun 7, 2024
@yurks
Copy link
Contributor Author

yurks commented Jun 7, 2024

@JoviDeCroock just prepared the same, but too late) Thanks!

@negezor
Copy link
Contributor

negezor commented Jun 18, 2024

Now it breaks down queries that don't have variables:

error TS2345: Argument of type '{}' is not assignable to parameter of type 'Omit<UseQueryArgs<never, Exact<{ [key: string]: never; }>>, "query">'.
  Property 'variables' is missing in type '{}' but required in type 'Omit<UseQueryArgs<never, Exact<{ [key: string]: never; }>>, "query">'.

29 const { data } = useFetchUserProvidersQuery({});
                                               ~~

  node_modules/@urql/core/dist/urql-core-chunk.d.ts:848:5
    848     variables: Variables;
            ~~~~~~~~~
    'variables' is declared here.

@yurks
Copy link
Contributor Author

yurks commented Jun 18, 2024

@negezor you are using codegen, and that's a typing issue in @graphql-codegen/typescript-vue-urql. There was an attempt to fix typings according urql-vue types refactor someday, but it was done incorrectly, as variables lost reactivity.

If you can try to use urql-vue methods directly, you'll see empty variables working as expected.

A bit more mess: based on your example you're using useFetchUserProvidersQuery({}), where {} is kind of workaround. With urql-vue@1.0.4 it worked just like useFetchUserProvidersQuery(), which is correct.

Looks like we are using the same stack, so I can recommend you temporary resolve this issue with useFetchUserProvidersQuery({ variables: {}}), until
@graphql-codegen/typescript-vue-urql will be fixed.

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.

None yet

3 participants