Skip to content

Commit

Permalink
Merge branch 'main' into renovate/node-16.x
Browse files Browse the repository at this point in the history
  • Loading branch information
jpvajda authored Aug 5, 2022
2 parents cf47c8e + 2c57dd4 commit 6471df2
Show file tree
Hide file tree
Showing 15 changed files with 93 additions and 80 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
name: Jest suite with coverage
command: npm run test:ci
environment:
JEST_JUNIT_OUTPUT: "reports/junit/js-test-results.xml"
JEST_JUNIT_OUTPUT_FILE: "reports/junit/js-test-results.xml"
- store_test_results:
path: reports/junit
- store_artifacts:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,6 @@ junit.xml

# Local Netlify folder
.netlify

# Ignore generated test report output
reports
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
legacy-peer-deps=true
18 changes: 12 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@ Oh, and if you haven't already, join our [community forums](https://community.ap

Here are some ways to contribute to the project, from easiest to most difficult:

* [Reporting bugs](#reporting-bugs)
* [Improving the documentation](#improving-the-documentation)
* [Responding to issues](#responding-to-issues)
* [Small bug fixes](#small-bug-fixes)
* [Suggesting features](#suggesting-features)
* [Big pull requests](#big-prs)
- [Issues](#issues)
- [Reporting bugs](#reporting-bugs)
- [Improving the documentation](#improving-the-documentation)
- [Responding to issues](#responding-to-issues)
- [Small bug fixes](#small-bug-fixes)
- [Suggesting features](#suggesting-features)
- [Big PRs](#big-prs)
- [Code review guidelines](#code-review-guidelines)
- [Development](#development)
- [Building](#building)
- [Testing](#testing)
- [Wiring a checkout into an application](#wiring-a-checkout-into-an-application)

## Issues

Expand Down
12 changes: 8 additions & 4 deletions ROADMAP.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 🔮 Apollo Client Roadmap

**Last updated: June 2022**
**Last updated: Aug 2022**

For up to date release notes, refer to the project's [Change Log](https://github.com/apollographql/apollo-client/blob/main/CHANGELOG.md).

Expand All @@ -15,15 +15,19 @@ For up to date release notes, refer to the project's [Change Log](https://github

## 3.7

- Release 3.7: will focus on cache & performance improvements as well as adding new hooks: `useBackgroundQuery`, `useFragment` See Github [3.7 Milestone](https://github.com/apollographql/apollo-client/milestone/28) for more details.
- Release 3.7 will focus on adding support for the `@defer` directive. See Github [3.7 Milestone](https://github.com/apollographql/apollo-client/milestone/28) for more details.

## 3.8

- Release 3.8 will focus on adding support for `Suspense` & `RefetchQuery` improvements. See Github [3.8 Milestone](https://github.com/apollographql/apollo-client/milestone/30) for more details.
- Release 3.8: will focus on cache & performance improvements as well as adding new hooks: `useBackgroundQuery`, `useFragment` See Github [3.8 Milestone](https://github.com/apollographql/apollo-client/milestone/30) for more details.

## 3.9

- *TBD*
- Release 3.9 will focus on adding support for React 18 `Suspense`. See Github [3.9 Milestone](https://github.com/apollographql/apollo-client/milestone/32) for more details.

## 3.10

- Release 3.10 will focus on adding better support for React 18 `SSR` architecture. See Github [3.10 Milestone](https://github.com/apollographql/apollo-client/milestone/33) for more details.

## 4.0

Expand Down
12 changes: 6 additions & 6 deletions docs/source/api/cache/InMemoryCache.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ By specifying the ID of another cached object, you can modify arbitrary cached d
</td>
<td>

If `true`, automatically refresh all active queries that depend on at least one field that's modified by this call.
If `true`, automatically refresh all active queries that depend on at least one field that's modified by this call. If `false`, silences the broadcast of cache updates and prevents automatic query refresh.

The default value is `true`.
</td>
Expand Down Expand Up @@ -403,7 +403,7 @@ By specifying the ID of another cached object, you can modify arbitrary cached d
</td>
<td>

If `true`, automatically refresh all active queries that depend on at least one field that's modified by this call.
If `true`, automatically refresh all active queries that depend on at least one field that's modified by this call. If `false`, silences the broadcast of cache updates and prevents automatic query refresh.

The default value is `true`.
</td>
Expand Down Expand Up @@ -724,7 +724,7 @@ A map of any GraphQL variable names and values required by `fragment`.
</td>
<td>

If `true`, automatically refresh all active queries that depend on at least one field that's modified by this call.
If `true`, automatically refresh all active queries that depend on at least one field that's modified by this call. If `false`, silences the broadcast of cache updates and prevents automatic query refresh.

The default value is `true`.
</td>
Expand Down Expand Up @@ -862,7 +862,7 @@ A map of any GraphQL variable names and values required by `fragment`.
</td>
<td>

If `true`, automatically refresh all active queries that depend on at least one field that's modified by this call.
If `true`, automatically refresh all active queries that depend on at least one field that's modified by this call. If `false`, silences the broadcast of cache updates and prevents automatic query refresh.

The default value is `true`.
</td>
Expand Down Expand Up @@ -1021,7 +1021,7 @@ The default value is `false`.
</td>
<td>

If `true`, automatically refresh all active queries that depend on at least one field that's modified by this call.
If `true`, automatically refresh all active queries that depend on at least one field that's modified by this call. If `false`, silences the broadcast of cache updates and prevents automatic query refresh.

The default value is `true`.
</td>
Expand Down Expand Up @@ -1243,7 +1243,7 @@ Otherwise, all instances of the field are removed for the cached object.
</td>
<td>

If `true`, automatically refresh all active queries that depend on at least one field that's removed by this call.
If `true`, automatically refresh all active queries that depend on at least one field that's removed by this call. If `false`, silences the broadcast of cache updates and prevents automatic query refresh.

The default value is `true`.
</td>
Expand Down
13 changes: 7 additions & 6 deletions docs/source/api/react/hooks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,15 @@ One way to access the configured Apollo Client instance directly is to create an
### Example

```jsx
import React from 'react';
import { ApolloConsumer } from '@apollo/client';

const WithApolloClient = () => (
<ApolloConsumer>
{client => 'We have access to the client!' /* do stuff here */}
</ApolloConsumer>
);
function WithApolloClient() {
return (
<ApolloConsumer>
{client => 'We have access to the client!' /* do stuff here */}
</ApolloConsumer>
);
}
```

## `useQuery`
Expand Down
27 changes: 24 additions & 3 deletions docs/source/caching/cache-field-behavior.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ You can use a `merge` function to intelligently combine nested objects that are

<ExpansionPanel title="See the code">

```ts{6-8}
```ts {6-8}
const cache = new InMemoryCache({
typePolicies: {
Book: {
Expand Down Expand Up @@ -219,7 +219,7 @@ With this schema, our cache can normalize `Book` objects because they have an `i

Now, let's say our client executes the following two queries, in order:

```graphql{5,14}
```graphql {5,14}
query BookWithAuthorName {
favoriteBook {
id
Expand Down Expand Up @@ -256,7 +256,7 @@ When the _first_ query returns, Apollo Client writes a `Book` object like the fo
Now, when the _second_ query returns, the cached `Book` object is updated to the following:

```json{6}
```json {6}
{
"__typename": "Book",
"id": "abc123",
Expand Down Expand Up @@ -337,6 +337,27 @@ These configurations have the same behavior, but putting the `merge: true` in th

Remember that mergeable objects will only be merged with existing objects occupying the same field of the same parent object, and only when the `__typename` of the objects is the same. If you really need to work around these rules, you can write a custom `merge` function to do whatever you want, but `merge: true` follows these rules.

In some cases, you might want to completely disable merge functions for certain fields. To do so, pass `merge: false` like so:

```ts {13}
const cache = new InMemoryCache({
typePolicies: {
Book: {
fields: {
// No longer necessary!
// author: {
// merge: true,
// },
},
},

Author: {
merge: false,
},
},
});
```

### Merging arrays of non-normalized objects

Once you're comfortable with the ideas and recommendations from the previous section, consider what happens when a `Book` can have multiple authors:
Expand Down
1 change: 1 addition & 0 deletions docs/source/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ This documentation set focuses on React, but Apollo Client supports many other l
- [Angular](https://apollo-angular.com)
- [Vue](integrations/integrations/#vue)
- [Svelte](integrations/integrations/#svelte)
- [Solid.js](https://github.com/merged-js/solid-apollo) (thanks to [Torsten85](https://github.com/Torsten85))
- [Ember](integrations/integrations/#ember)
- [Meteor](https://www.meteor.com) (thanks to [DDP-Apollo](https://github.com/Swydo/ddp-apollo))
- Web Components
Expand Down
18 changes: 9 additions & 9 deletions docs/source/pagination/key-args.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The Apollo Client cache can store multiple entries for a single schema field. By

For example, consider this `Query.user` field:

```graphql{3}
```graphql {3}
type Query {
# Returns whichever User object corresponds to `id`
user(id: ID!): User
Expand All @@ -18,7 +18,7 @@ type Query {

If we query for `User`s with `id`s `1` and `2`, the Apollo Client cache stores entries for _both_ like so:

```js{3,6}:title=Cache
```js {3,6} title="Cache"
{
'ROOT_QUERY': {
'user({"id":"1"})': {
Expand All @@ -43,7 +43,7 @@ Certain arguments _shouldn't_ cause the Apollo Client cache to store a separate

Consider this `Query.feed` field:

```graphql{2}
```graphql {2}
type Query {
feed(offset: Int, limit: Int, category: Category): [FeedItem!]
}
Expand All @@ -65,7 +65,7 @@ query GetFeedItems {

But because their argument values differ, these two lists of ten items are cached _separately_ by default. This means that when the second query completes, the returned items _aren't_ appended to the original list in the feed!

```js{3-4,10-11}:title=Cache
```js {3-4,10-11} title="Cache"
{
'ROOT_QUERY': {
// First query
Expand Down Expand Up @@ -94,7 +94,7 @@ To help handle this case, we can [set key arguments](#setting-keyargs) for the f

A **key argument** is an argument for a GraphQL field that's included in cache storage keys for that field. By default, _all_ GraphQL arguments are key arguments, as shown in our feed example:

```js{3-4,10-11}:title=Cache
```js {3-4,10-11} title="Cache"
{
'ROOT_QUERY': {
// First query
Expand All @@ -117,7 +117,7 @@ A **key argument** is an argument for a GraphQL field that's included in cache s

You can override this default behavior by defining a cache [field policy](../caching/cache-field-behavior) for a particular field:

```js{5-7}
```js {5-7}
const cache = new InMemoryCache({
typePolicies: {
Query: {
Expand Down Expand Up @@ -213,7 +213,7 @@ When deciding which of a field's arguments to include in `keyArgs`, it's helpful

If all arguments are key arguments (this is the default behavior), every distinct combination of argument values for a field results in a distinct cache entry. In other words, changing any argument value results in a different storage key, so the returned value is stored separately. We see this in our pagination example:

```js{3-4,10-11}:title=Cache
```js {3-4,10-11} title="Cache"
{
'ROOT_QUERY': {
// First query
Expand All @@ -236,7 +236,7 @@ If all arguments are key arguments (this is the default behavior), every distinc

With this approach, Apollo Client can't return a cached value for a field unless _all_ of the field's arguments match a previously cached result. This significantly reduces the cache's hit rate, but it also prevents the cache from returning an incorrect value when differences in arguments are relevant (as with our `User` example):

```js{3,6}:title=Cache
```js {3,6} title="Cache"
{
'ROOT_QUERY': {
'user({"id":"1"})': {
Expand All @@ -259,7 +259,7 @@ This default behavior is often undesirable (especially for a paginated list), so

Recall this `Query.feed` field from [Pagination issues](#pagination-issues):

```graphql{2}
```graphql {2}
type Query {
feed(offset: Int, limit: Int, category: Category): [FeedItem!]
}
Expand Down
19 changes: 0 additions & 19 deletions package-lock.json

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

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"test:ci": "npm run test:coverage && npm run test:memory",
"test:watch": "jest --config ./config/jest.config.js --watch",
"test:memory": "cd scripts/memory && npm i && npm test",
"test:coverage": "npm run coverage -- --ci --maxWorkers=2 --reporters=default --reporters=jest-junit",
"test:coverage": "npm run coverage -- --ci --runInBand --reporters=default --reporters=jest-junit",
"coverage": "jest --config ./config/jest.config.js --verbose --coverage",
"bundlesize": "npm run build && bundlesize",
"predeploy": "npm run build",
Expand Down Expand Up @@ -115,7 +115,6 @@
"acorn": "8.7.1",
"bundlesize": "0.18.1",
"cross-fetch": "3.1.5",
"crypto-hash": "1.3.0",
"fetch-mock": "9.11.0",
"glob": "8.0.3",
"graphql": "16.5.0",
Expand Down
23 changes: 9 additions & 14 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
{
"extends": [
"apollo-open-source"
],
"extends": ["apollo-open-source"],
"pathRules": [
{
"paths": [
"docs/package.json"
],
"extends": [
"apollo-docs"
]
"paths": ["docs/package.json"],
"extends": ["apollo-docs"]
}
],
"packageRules": {
"excludePackageNames": [
"typedoc"
]
}
"ignoreDeps": [
"typedoc",
"react-17",
"react-dom-17",
"@testing-library/react-12"
]
}
Loading

0 comments on commit 6471df2

Please sign in to comment.