urql-graphql / urql

The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
https://urql.dev/goto/docs
MIT License
8.54k stars 444 forks source link

feat(vue): refactor composable functions #3619

Open yurks opened 2 weeks ago

yurks commented 2 weeks ago

Summary

This includes https://github.com/urql-graphql/urql/pull/3612, but fixed reactivity loosing here.

In addition, a little refactoring for use* composable functions for reducing code duplication and adding more test cases.

Set of changes

changeset-bot[bot] commented 2 weeks ago

🦋 Changeset detected

Latest commit: 24a3889738f46750b2ef6af632ee0ba8cebd7ebe

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | --------- | ----- | | @urql/vue | Minor |

Not sure what this means? Click here to learn what changesets are.

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

negezor commented 1 week ago

This is a really good refactoring. The only thing that bothers me is why the effects in useClientHandle() were initially manually stopped; I couldn’t find the reason (or I didn’t look well).

yurks commented 1 week ago

Thanks @negezor ☀️

why the effects in useClientHandle() were initially manually stopped

The reason of having useClientHandle() and manually stopping watchers I found is here https://github.com/urql-graphql/urql/pull/3610#issuecomment-2178843530. And the reason it was removed in current PR - I consider this as excessive concern for rare use cases and attempt to bypass vue limitations, which should be completely on users responsibility imho.

But I can agree this kind of removal is overkill for mine "little refactoring", so I'll revert this functionality here. I guess we can found an optimal solution in scope of that PR.

negezor commented 6 days ago

@kitten could you please review the PR?