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

chore(deps): update dependency @connectrpc/protoc-gen-connect-query to v1 #168

Merged
merged 2 commits into from
Dec 22, 2023

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Dec 15, 2023

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
@connectrpc/protoc-gen-connect-query (source) ^0.6.0 -> ^1.0.0 age adoption passing confidence

Release Notes

connectrpc/connect-query-es (@​connectrpc/protoc-gen-connect-query)

v1.1.1

Compare Source

What's Changed

Full Changelog: connectrpc/connect-query-es@v1.1.0...v1.1.1

v1.1.0

Compare Source

What's Changed

CJS output

By default, protoc-gen-connect-query (and all other plugins based on @​bufbuild/protoplugin) generate ECMAScript import and export statements. For use cases where CommonJS is difficult to avoid, a new plugin option has been added named js_import_style which can be used to generate CommonJS require() calls.

Here is an example buf.gen.yaml:

version: v1
plugins:

### You'll need @​bufbuild/protoc-gen-es v1.6.0 or later
  - plugin: es
    out: src/gen
    opt: js_import_style=legacy_commonjs
  - plugin: protoc-gen-connect-query
    out: src/gen
    opt: js_import_style=legacy_commonjs

To view the full PR, see Added support for cjs output by @​paul-sachs in https://github.com/connectrpc/connect-query-es/pull/303

Full Changelog: connectrpc/connect-query-es@v1.0.0...v1.1.0

v1.0.0

Compare Source

What's Changed

V1 Release 🚀

Introducing a whole new API for connect-query. This API ties itself more tightly with the fantastic @tanstack/react-query in order to improve developer experience and reduce bundle size.

At the core of this change is the new MethodUnaryDescriptor type, which is essentially just a self contained description of a service method. The new code generator just outputs one of these per method and those are passed to the hooks/methods. This new additional type brings a huge level of flexibility about how we write additional methods, and it's trivial to write your own hooks/methods around these simple types.

Example usage
import { useQuery } from "@​connectrpc/connect-query";
import { say } from "./gen/eliza-ElizaService_connectquery";

...

const { data } = useQuery(say);
Breaking changes
  • use*Query hooks now return data instead of just options.
  • Many create* methods have been removed.
  • protoc-gen-connect-query now outputs very simple method descriptors instead of a bunch of hooks per method.
Reasoning

There are a number of reasons we've decided to make this major breaking change.

  1. The API surface is much smaller, leading to less confusion about how to use each method.
  2. Smaller core code size and more modular organization leads to better tree shaking (since each generated method doesn't come along with a generated hook).
  3. Package names are now explicit about their dependencies, making it easier to develop other packages based on these packages/generated code.
  4. More tightly integrating with @tanstack/react-query@5 provides better usage of Suspense versions of the API.
  5. New generated code is easier to expand and build your own custom hooks for.
Migration

The migration process is easy but manual:

Before
import { getUserOrganization } from "@​apigen/org/alpha/registry/v1alpha1/organization-OrganizationService_connectquery";
import { useQuery } from "@​tanstack/react-query";

...

const getUserOrganizationQuery = useQuery({
    ...getUserOrganization.useQuery({
      userId: currentUser?.id,
      organizationId,
    }),
    useErrorBoundary: false,
    enabled: currentUser !== null,
});
After
import { getUserOrganization } from "@​apigen/org/alpha/registry/v1alpha1/organization-OrganizationService_connectquery";
import { useQuery } from "@​connectrpc/connect-query";

...

const getUserOrganizationQuery = useQuery(getUserOrganization, {
      userId: currentUser?.id,
      organizationId,
    },
    {
      useErrorBoundary: false,
      enabled: currentUser !== null
    }
});

Full Changelog: connectrpc/connect-query-es@v0.6.0...v1.0.0


Configuration

📅 Schedule: Branch creation - "before 10am on friday" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

@renovate renovate bot added dependencies Pull requests that update a dependency file javascript labels Dec 15, 2023
@DavidS-ovm
Copy link
Contributor

@getinnocuous this reads as if it will require some work in the frontend. what do you say?

@getinnocuous
Copy link
Member

@getinnocuous this reads as if it will require some work in the frontend. what do you say?

Yes looks that way, much nicer API at least.

@DavidS-ovm
Copy link
Contributor

I'll leave it to you then to schedule merging and porting of this.

@getinnocuous getinnocuous merged commit 2d7c456 into main Dec 22, 2023
1 check passed
@getinnocuous getinnocuous deleted the renovate/connectrpc-protoc-gen-connect-query-1.x branch December 22, 2023 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file javascript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants