Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 0 additions & 57 deletions .changeset/new-response-format.md

This file was deleted.

56 changes: 56 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# @remix-relay/react

## 3.0.0

### Major Changes

- [#3](https://github.com/dantrain/remix-relay/pull/3) [`d2fb8cd`](https://github.com/dantrain/remix-relay/commit/d2fb8cdedcee9e5f7c015f930c54b6a2b269fc5a) Thanks [@dantrain](https://github.com/dantrain)! - Update to GraphQL incremental delivery format (incrementalSpec v0.2)

### Breaking changes
- **`graphql` peer dependency updated from `17.0.0-alpha.2` to `17.0.0-alpha.9`** - Adopts the newer incremental delivery response format with `pending`/`incremental`/`completed` fields.
- **Client fetch function must use `processMultipartResponse`** - The client-side relay environment fetch function must be updated to use the new `processMultipartResponse` utility exported from `@remix-relay/react`, which handles the new response format. The `Accept` header must also change from `deferSpec=20220824` to `incrementalSpec=v0.2`.

### Migration

Update the `graphql` dependency:

```shell
pnpm add graphql@17.0.0-alpha.9
```

Update the client relay environment fetch function to use `processMultipartResponse`:

```typescript
import {
getCachedResponse,
processMultipartResponse,
} from "@remix-relay/react";

const fetchFn: FetchFunction = (params, variables, cacheConfig) => {
return (
getCachedResponse(params, variables, cacheConfig) ??
Observable.create((sink) => {
(async () => {
try {
const response = await fetch("/graphql", {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "multipart/mixed; incrementalSpec=v0.2, application/json",
},
body: JSON.stringify({ query: params.text, variables }),
});

const parts = await meros(response);

for await (const payload of processMultipartResponse(parts)) {
sink.next(payload);
}
} finally {
sink.complete();
}
})();
})
);
};
```
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@remix-relay/react",
"version": "2.4.8",
"version": "3.0.0",
"description": "Provides Relay integration with React Router (Framework)",
"keywords": [
"Remix",
Expand Down
56 changes: 56 additions & 0 deletions packages/server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# @remix-relay/server

## 3.0.0

### Major Changes

- [#3](https://github.com/dantrain/remix-relay/pull/3) [`d2fb8cd`](https://github.com/dantrain/remix-relay/commit/d2fb8cdedcee9e5f7c015f930c54b6a2b269fc5a) Thanks [@dantrain](https://github.com/dantrain)! - Update to GraphQL incremental delivery format (incrementalSpec v0.2)

### Breaking changes
- **`graphql` peer dependency updated from `17.0.0-alpha.2` to `17.0.0-alpha.9`** - Adopts the newer incremental delivery response format with `pending`/`incremental`/`completed` fields.
- **Client fetch function must use `processMultipartResponse`** - The client-side relay environment fetch function must be updated to use the new `processMultipartResponse` utility exported from `@remix-relay/react`, which handles the new response format. The `Accept` header must also change from `deferSpec=20220824` to `incrementalSpec=v0.2`.

### Migration

Update the `graphql` dependency:

```shell
pnpm add graphql@17.0.0-alpha.9
```

Update the client relay environment fetch function to use `processMultipartResponse`:

```typescript
import {
getCachedResponse,
processMultipartResponse,
} from "@remix-relay/react";

const fetchFn: FetchFunction = (params, variables, cacheConfig) => {
return (
getCachedResponse(params, variables, cacheConfig) ??
Observable.create((sink) => {
(async () => {
try {
const response = await fetch("/graphql", {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "multipart/mixed; incrementalSpec=v0.2, application/json",
},
body: JSON.stringify({ query: params.text, variables }),
});

const parts = await meros(response);

for await (const payload of processMultipartResponse(parts)) {
sink.next(payload);
}
} finally {
sink.complete();
}
})();
})
);
};
```
2 changes: 1 addition & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@remix-relay/server",
"version": "2.4.8",
"version": "3.0.0",
"description": "Provides Relay integration with React Router (Framework)",
"keywords": [
"Remix",
Expand Down