Skip to content

Commit

Permalink
Version Packages (alpha) (#11336)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and github-actions[bot] committed Nov 2, 2023
1 parent 46ab032 commit be2029b
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
},
"changesets": [
"beige-geese-wink",
"breezy-spiders-tap",
"good-experts-repair",
"shaggy-ears-scream",
"sour-sheep-walk",
"strong-terms-perform",
"yellow-flies-repeat"
]
}
84 changes: 84 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,89 @@
# @apollo/client

## 3.9.0-alpha.3

### Minor Changes

- [#11301](https://github.com/apollographql/apollo-client/pull/11301) [`46ab032af`](https://github.com/apollographql/apollo-client/commit/46ab032af83a01f184bfcce5edba4b55dbb2962a) Thanks [@alessbell](https://github.com/alessbell)! - Add multipart subscription network adapters for Relay and urql

### Relay

```tsx
import { createFetchMultipartSubscription } from "@apollo/client/utilities/subscriptions/relay";
import { Environment, Network, RecordSource, Store } from "relay-runtime";

const fetchMultipartSubs = createFetchMultipartSubscription(
"http://localhost:4000"
);

const network = Network.create(fetchQuery, fetchMultipartSubs);

export const RelayEnvironment = new Environment({
network,
store: new Store(new RecordSource()),
});
```

### Urql

```tsx
import { createFetchMultipartSubscription } from "@apollo/client/utilities/subscriptions/urql";
import { Client, fetchExchange, subscriptionExchange } from "@urql/core";

const url = "http://localhost:4000";

const multipartSubscriptionForwarder = createFetchMultipartSubscription(url);

const client = new Client({
url,
exchanges: [
fetchExchange,
subscriptionExchange({
forwardSubscription: multipartSubscriptionForwarder,
}),
],
});
```

### Patch Changes

- [#11275](https://github.com/apollographql/apollo-client/pull/11275) [`3862f9ba9`](https://github.com/apollographql/apollo-client/commit/3862f9ba9086394c4cf4c2ecd99e8e0f6cf44885) Thanks [@phryneas](https://github.com/phryneas)! - Add a `defaultContext` option and property on `ApolloClient`, e.g. for keeping track of changing auth tokens or dependency injection.

This can be used e.g. in authentication scenarios, where a new token might be
generated outside of the link chain and should passed into the link chain.

```js
import { ApolloClient, createHttpLink, InMemoryCache } from "@apollo/client";
import { setContext } from "@apollo/client/link/context";

const httpLink = createHttpLink({
uri: "/graphql",
});

const authLink = setContext((_, { headers, token }) => {
return {
headers: {
...headers,
authorization: token ? `Bearer ${token}` : "",
},
};
});

const client = new ApolloClient({
link: authLink.concat(httpLink),
cache: new InMemoryCache(),
});

// somewhere else in your application
function onNewToken(newToken) {
// token can now be changed for future requests without need for a global
// variable, scoped ref or recreating the client
client.defaultContext.token = newToken;
}
```

- [#11297](https://github.com/apollographql/apollo-client/pull/11297) [`c8c76a522`](https://github.com/apollographql/apollo-client/commit/c8c76a522e593de0d06cff73fde2d9e88152bed6) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add an explicit return type for the `useReadQuery` hook called `UseReadQueryResult`. Previously the return type of this hook was inferred from the return value.

## 3.9.0-alpha.2

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@apollo/client",
"version": "3.9.0-alpha.2",
"version": "3.9.0-alpha.3",
"description": "A fully-featured caching GraphQL client.",
"private": true,
"keywords": [
Expand Down

0 comments on commit be2029b

Please sign in to comment.