Skip to content

Tags: fossabot/connect-query-es

Tags

v1.4.1

Toggle v1.4.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Release 1.4.1 (connectrpc#370)

## What's Changed
* Respect enabled:false in QueryClient's default options by @anuraaga in
connectrpc#369

## New Contributors
* @anuraaga made their first contribution in
connectrpc#369

**Full Changelog**:
connectrpc/connect-query-es@v1.4.0...v1.4.1

Signed-off-by: Paul Sachs <[email protected]>

v1.4.0

Toggle v1.4.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Release 1.4.0 (connectrpc#368)

## What's Changed
* Need mutation context generic to support passing context by
@paul-sachs in connectrpc#359
* Make sure generated keys include defaults by @paul-sachs in
connectrpc#366


**Full Changelog**:
connectrpc/connect-query-es@v1.3.1...v1.4.0

v1.3.1

Toggle v1.3.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Release 1.3.1 (connectrpc#353)

## What's Changed
* Pass abort signal to transport for mutations by @paul-sachs in
connectrpc#351


**Full Changelog**:
connectrpc/connect-query-es@v1.3.0...v1.3.1

v1.3.0

Toggle v1.3.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Release 1.3.0 (connectrpc#346)

## What's Changed
* Prevent using extendible input type by @paul-sachs in
connectrpc#345
* Expose internal methods used to create query options by @paul-sachs in
connectrpc#343

**Full Changelog**:
connectrpc/connect-query-es@v1.2.0...v1.3.0

v1.2.0

Toggle v1.2.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Release 1.2.0 (connectrpc#339)

## What's Changed
* Add a distinguishing factor between infinite query keys and regular
query keys by @paul-sachs in
connectrpc#334
* Add support for enabled to useInfiniteQuery by @paul-sachs in
connectrpc#338

## Changes to infinite query keys

With connectrpc#334, we're
fixing a bug where the cache of a regular query collides with the cache
of an infinite query, which can lead to type mismatches and unexpected
failures if you use the same RPC with an infinite query and a regular
query.
We are now using a separate query key for infinite queries to solve the
issue (we append "infinite" to the key), but this change can potentially
affect you:

If you tried to invalidate some infinite queries like
`queryClient.invalidateQueries({ queryKey: createConnectQueryKey(...),
exact: true })`, this now only invalidates queries initialized with
`useQuery`. To invalidate infinite queries, you can either set `exact`
to false, or use `createConnectInfiniteQueryKey()` instead. Also note
that this change not only affects `invalidateQueries` but any operations
against the queryClient that interact with the cache using a key (eg,
queryClient.setQueriesData, etc.)

**Full Changelog**:
connectrpc/connect-query-es@v1.1.3...v1.2.0

v1.1.3

Toggle v1.1.3's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Release 1.1.3 (connectrpc#323)

## What's Changed
* Add interceptor example to readme by @paul-sachs in
connectrpc#313
* Make sure to take into account enabled queryOption by @paul-sachs in
connectrpc#318


**Full Changelog**:
connectrpc/connect-query-es@v1.1.2...v1.1.3

v1.1.2

Toggle v1.1.2's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Release 1.1.2 (connectrpc#314)

## What's Changed
* Remove ESM wrapper by @paul-sachs in
connectrpc#312


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

v1.1.1

Toggle v1.1.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Release 1.1.1 (connectrpc#311)

## What's Changed

* Fix dual package hazard in nodejs by @paul-sachs in
connectrpc#310

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

v1.1.0

Toggle v1.1.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Release 1.1.0 (connectrpc#308)

## What's Changed
* Update imports to include file extensions by @paul-sachs in
connectrpc#299 and
connectrpc#307
* Added support for cjs output by @paul-sachs in
connectrpc#303
* Loosen peer dependency requirement by @paul-sachs in
connectrpc#306

## CJS output

By default,
[protoc-gen-connect-query](https://www.npmjs.com/package/@connectrpc/protoc-gen-connect-query)
(and all other plugins based on
[@bufbuild/protoplugin](https://www.npmjs.com/package/@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](https://buf.build/docs/configuration/v1/buf-gen-yaml):

```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 connectrpc#303

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

v1.0.0

Toggle v1.0.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Release 1.0.0 (connectrpc#294)

## What's Changed
* V1 API: Wrapping react-query by @paul-sachs in
connectrpc#224

## 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

```tsx
import { useQuery } from "@connectrpc/connect-react-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

```tsx
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

```tsx
import { getUserOrganization } from "@apigen/org/alpha/registry/v1alpha1/organization-OrganizationService_connectquery";
import { useQuery } from "@connectrpc/connect-react-query";

...

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

## New Contributors
* @chrispine made their first contribution in
connectrpc#243

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