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

Release 3.2.0 #6774

Merged
merged 115 commits into from
Sep 14, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
7112d03
feature: added support for automatic type inference with typed-docume…
dotansimha Jul 28, 2020
36dc45b
update typed-document-node to 1.0.0
dotansimha Jul 29, 2020
9614c65
update version, move to devDependency, added re-export
dotansimha Aug 4, 2020
c550dc3
update lockfile
dotansimha Aug 4, 2020
af18c78
Move TypedDocumentNode to src/core/types.ts.
benjamn Aug 4, 2020
2e0c725
More tests of TypedDocumentNode and cache.{read,write}{Query,Fragment}.
benjamn Aug 4, 2020
02528dd
Move @graphql-typed-document-node/core back to dependencies.
benjamn Aug 4, 2020
081e604
Merge pull request #6720 from dotansimha/feature/typed-document-node
benjamn Aug 4, 2020
c689897
Add beta tag to npm deploy script.
benjamn Aug 4, 2020
15d6324
Mention PR #6720 in CHANGELOG.md.
benjamn Aug 4, 2020
b883fc6
Bump @apollo/client npm version to 3.2.0-beta.0.
benjamn Aug 4, 2020
96f86d2
Bump `@graphql-typed-document-node/core` to v3 (#6778)
dotansimha Aug 5, 2020
e62c734
Merge branch 'master' into release-3.2
benjamn Aug 6, 2020
6577c4a
Bump @apollo/client npm version to 3.2.0-beta.1.
benjamn Aug 6, 2020
46dd608
Disable feud-stopping logic after any cache eviction. (#6817)
benjamn Aug 10, 2020
fe590bc
Bump @apollo/client npm version to 3.2.0-beta.2.
benjamn Aug 10, 2020
2839ee4
Merge branch 'master' into release-3.2
benjamn Aug 17, 2020
c7b3ccd
Set result.partial only if true in getCurrentResult.
benjamn Aug 14, 2020
1dd9301
Simplify fetchMore loading result simulation.
benjamn Aug 14, 2020
97f3caf
Avoid full reobservation for broadcasts from optimistic transactions.
benjamn Aug 14, 2020
44a5f13
Fix optimistic mutation tests, again.
benjamn Aug 17, 2020
8bb4820
Make it clearer that saveAsLastResult defaults to true.
benjamn Aug 17, 2020
e64b642
Keep ObservableQuery#observe private for now.
benjamn Aug 18, 2020
d61fa8a
Mention PR #6854 in CHANGELOG.md.
benjamn Aug 18, 2020
9866ead
Merge pull request #6854 from apollographql/avoid-full-reobservation-…
benjamn Aug 18, 2020
2e2c645
Merge branch 'master' into release-3.2.
benjamn Aug 18, 2020
ac7717a
Bump @apollo/client npm version to 3.2.0-beta.3.
benjamn Aug 18, 2020
d183c22
Use context to track whether reading within @client subtree.
benjamn Aug 19, 2020
5023915
Merge branch 'master' into release-3.2.
benjamn Aug 20, 2020
45179b9
Generalize listening API for reactive variables.
benjamn Aug 20, 2020
2f494c8
Implement useReactiveVar hook.
benjamn Aug 20, 2020
141794c
Mention PR #6867 in CHANGELOG.md.
benjamn Aug 20, 2020
002e199
Docs for useReactiveVar.
benjamn Aug 20, 2020
b9382b0
Avoid visiting new listeners added by other listeners.
benjamn Aug 20, 2020
b874104
Store broadcastable caches separately from listeners.
benjamn Aug 20, 2020
83e2c1b
Merge pull request #6867 from apollographql/useReactiveVar
benjamn Aug 20, 2020
d89d728
Bump @apollo/client npm version to 3.2.0-beta.4.
benjamn Aug 20, 2020
583f62b
Throw when writeFragment cannot identify object
Aug 18, 2020
112228f
Warn if object cannot be identified
Aug 20, 2020
a2f90df
Add stringified result to error message
Aug 21, 2020
ea5a356
Mention PR #6859 in CHANGELOG.md.
benjamn Aug 21, 2020
766d3ff
Merge pull request #6859 from apollographql/writeFragment-identity-error
benjamn Aug 21, 2020
24a4396
Check structural equality in QueryInfo#setDiff. (#6891)
benjamn Aug 24, 2020
c4d100f
Use nextFetchPolicy when polling to restore original policy.
benjamn Aug 24, 2020
0bacd98
Use nextFetchPolicy in ObservableQuery#{refetch,setVariables}, too.
benjamn Aug 24, 2020
1ae25cc
Allow options.nextFetchPolicy to be a function.
benjamn Aug 24, 2020
f38d259
Mention PR #6893 in CHANGELOG.md.
benjamn Aug 25, 2020
03ee726
Merge pull request #6893 from apollographql/nextFetchPolicy-improvements
benjamn Aug 25, 2020
14091ce
Bump @apollo/client npm version to 3.2.0-beta.5.
benjamn Aug 25, 2020
00c4a13
Consider cache.modify a destructive method, like cache.evict.
benjamn Aug 25, 2020
889d103
Mention PR #6898 in CHANGELOG.md.
benjamn Aug 25, 2020
53455f5
Regression test for PRs #6898 and #6817.
benjamn Aug 25, 2020
5b9581b
Merge pull request #6898 from apollographql/consider-cache.modify-des…
benjamn Aug 25, 2020
75499a7
Merge branch 'main' into release-3.2.
benjamn Aug 25, 2020
cb46484
Bump @apollo/client npm version to 3.2.0-beta.6.
benjamn Aug 25, 2020
aae3a1e
Merge branch 'main' into release-3.2.
benjamn Aug 27, 2020
95d2a75
Bump @apollo/client npm version to 3.2.0-beta.7.
benjamn Aug 27, 2020
1a601d8
Ensure cache.{evict,modify} not wrapped more than once.
benjamn Aug 28, 2020
ab5a4f0
Better type inference for {Query,Subscription,Mutation}.propTypes.
benjamn Aug 28, 2020
4908ad7
Bump @apollo/client npm version to 3.2.0-beta.8.
benjamn Aug 28, 2020
c2ef68f
Revert "Check structural equality in QueryInfo#setDiff. (#6891)"
benjamn Aug 28, 2020
0c04a83
Bump @apollo/client npm version to 3.2.0-beta.9.
benjamn Aug 28, 2020
e52d0fb
Merge branch 'main' into release-3.2.
benjamn Aug 30, 2020
d3d4b3b
Hoist shared details out of EntityStore#modify forEach loop.
benjamn Aug 27, 2020
558d1ef
Allow cache.modify to invalidate fields without altering them.
benjamn Aug 27, 2020
8911805
Provide options.storage to cache.modify functions, too.
benjamn Aug 22, 2020
a8758de
Never let options.storage be null.
benjamn Sep 8, 2020
47c00e7
Make EntityStore.Root responsible for options.storage management.
benjamn Sep 8, 2020
bd66129
Add more tests of options.storage, including cache.modify.
benjamn Sep 8, 2020
95f1a6f
Bump bundlesize limit to 24.7kB.
benjamn Sep 8, 2020
59d5940
Mention PR #6991 in CHANGELOG.md.
benjamn Sep 8, 2020
d1fceb6
Documentation for cache.modify details.INVALIDATE sentinel.
benjamn Sep 8, 2020
2c15bb4
Mention details.INVALIDATE in cache.modify API docs.
benjamn Sep 8, 2020
6e3c999
Merge pull request #6991 from apollographql/cache.modify-invalidation
benjamn Sep 8, 2020
f4d214b
Merge branch 'main' into release-3.2.
benjamn Sep 8, 2020
e086a40
Bump @apollo/client npm version to 3.2.0-beta.10.
benjamn Sep 8, 2020
7c06ad2
Merge branch 'main' into release-3.2.
benjamn Sep 9, 2020
c4a09b7
Eliminate unnecessary StoreReader#readQueryFromStore method.
benjamn Aug 20, 2020
065d317
Use getFragmentFromSelection helper in executeSelectionSet.
benjamn Aug 22, 2020
990a488
Invert storage of subtype-supertype relationships in Policies class.
benjamn Aug 21, 2020
1c54969
Bring back heuristic fragment matching, with a twist.
benjamn Aug 22, 2020
92a04db
Return early when inexact fragment type condition is unknown.
benjamn Aug 22, 2020
fcbc86f
Check selectionSetMatchesResult before checking fuzzy subtypes.
benjamn Aug 26, 2020
ae4a6f5
Add more tests of possibleTypes and fragmentMatches.
benjamn Sep 10, 2020
02b0ac8
Mention PR #6901 in CHANGELOG.md.
benjamn Sep 10, 2020
4a22dcb
Merge pull request #6901 from apollographql/heuristic-fragment-matchi…
benjamn Sep 10, 2020
0d510d4
Bump @apollo/client npm version to 3.2.0-beta.11.
benjamn Sep 10, 2020
ccb0a79
Remove invariant forbidding cache-only FetchPolicy in refetch.
benjamn Sep 10, 2020
59e9049
Initialize ObservableQuery in updateObservableQuery even if skip is t…
mu29 Sep 10, 2020
7e94986
Merge branch 'main' into release-3.2.
benjamn Sep 10, 2020
09c0249
Update CHANGELOG.md for recent release-3.2 changes.
benjamn Sep 10, 2020
cd6ff47
Bump @apollo/client npm version to 3.2.0-beta.12.
benjamn Sep 10, 2020
0c98c59
Add new persisted-queries deps
hwillson Aug 14, 2020
4029053
Initial persisted-queries code migration with modifications
hwillson Aug 14, 2020
ad01106
Add the persisted-queries entry point
hwillson Aug 14, 2020
b951c8f
Add @apollo/client/link/persisted-queries to the exports test
hwillson Aug 14, 2020
e255e76
Make `crypto-hash` a dev dep
hwillson Aug 24, 2020
802a0ba
Ensure a `sha256` or `generateHash` function is provided
hwillson Aug 24, 2020
2f7abb5
Adjust tests to accommodate required sha256/generateHash options
hwillson Aug 24, 2020
349296c
Stop unnecessarily exporting `defaultOptions`
hwillson Aug 24, 2020
e4a32ef
Add link docs
hwillson Sep 10, 2020
3e3f5e7
Simplify createPersistedQueryLink options processing.
benjamn Sep 11, 2020
ce4d702
Allow GenerateHashFunction to return string | PromiseLike<string>.
benjamn Sep 11, 2020
68d3911
Use WeakMap to avoid adding Symbol properties to DocumentNode objects.
benjamn Sep 11, 2020
b333475
Simplify confusingly-named operationIsQuery helper.
benjamn Sep 11, 2020
8ad97aa
Support @apollo/client/link/persisted-queries in imports transform.
benjamn Sep 11, 2020
701eb3b
Mention PR #6837 in CHANGELOG.md.
benjamn Sep 11, 2020
f2b60c5
Merge pull request #6837 from apollographql/persisted-queries-link
benjamn Sep 11, 2020
62facae
Respect errorPolicy for mutation and subscription results. (#7003)
benjamn Sep 11, 2020
5441987
Bump @apollo/client npm version to 3.2.0-rc.0.
benjamn Sep 11, 2020
88afcd4
Merge branch 'main' into release-3.2.
benjamn Sep 14, 2020
9d3c847
Make CHANGELOG.md note about TypedDocumentNode more precise.
benjamn Sep 14, 2020
27304e2
Reorganize change list for v3.2.0.
benjamn Sep 14, 2020
b977779
Remove --tag beta from npm deploy command.
benjamn Sep 14, 2020
062b76b
Bump @apollo/client npm version to 3.2.0. :tada:
benjamn Sep 14, 2020
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
Prev Previous commit
Next Next commit
Remove invariant forbidding cache-only FetchPolicy in refetch.
Fixes #6702.
  • Loading branch information
benjamn committed Sep 10, 2020
commit ccb0a79a588721f08bf87a131c31bf37fa3238e5
11 changes: 2 additions & 9 deletions src/core/ObservableQuery.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { invariant, InvariantError } from 'ts-invariant';
import { invariant } from 'ts-invariant';
import { equal } from '@wry/equality';

import { NetworkStatus, isNetworkRequestInFlight } from './networkStatus';
Expand Down Expand Up @@ -223,14 +223,6 @@ export class ObservableQuery<
* the previous values of those variables will be used.
*/
public refetch(variables?: Partial<TVariables>): Promise<ApolloQueryResult<TData>> {
let { fetchPolicy } = this.options;
// early return if trying to read from cache during refetch
if (fetchPolicy === 'cache-only') {
return Promise.reject(new InvariantError(
'cache-only fetchPolicy option should not be used together with query refetch.',
));
}

const reobserveOptions: Partial<WatchQueryOptions<TVariables, TData>> = {
// Always disable polling for refetches.
pollInterval: 0,
Expand All @@ -239,6 +231,7 @@ export class ObservableQuery<
// Unless the provided fetchPolicy always consults the network
// (no-cache, network-only, or cache-and-network), override it with
// network-only to force the refetch for this fetchQuery call.
const { fetchPolicy } = this.options;
if (fetchPolicy !== 'no-cache' &&
fetchPolicy !== 'cache-and-network') {
reobserveOptions.fetchPolicy = 'network-only';
Expand Down
57 changes: 57 additions & 0 deletions src/core/__tests__/fetchPolicies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import gql from 'graphql-tag';
import { ApolloClient, NetworkStatus } from '../../core';
import { ApolloLink } from '../../link/core';
import { InMemoryCache } from '../../cache';
import { Observable } from '../../utilities';
import {
stripSymbols,
subscribeAndCount,
Expand Down Expand Up @@ -439,6 +440,62 @@ describe('cache-first', () => {
});
});

describe('cache-only', () => {
itAsync('allows explicit refetch to happen', (resolve, reject) => {
let counter = 0;
const client = new ApolloClient({
cache: new InMemoryCache,
link: new ApolloLink(operation => new Observable(observer => {
observer.next({
data: {
count: ++counter,
},
});
observer.complete();
})),
});

const query = gql`query { counter }`;

const observable = client.watchQuery({
query,
nextFetchPolicy: 'cache-only',
});

subscribeAndCount(reject, observable, (count, result) => {
if (count === 1) {
expect(result).toEqual({
loading: false,
networkStatus: NetworkStatus.ready,
data: {
count: 1,
},
});

expect(observable.options.fetchPolicy).toBe('cache-only');

observable.refetch().catch(reject);

} else if (count === 2) {
expect(result).toEqual({
loading: false,
networkStatus: NetworkStatus.ready,
data: {
count: 2,
},
});

expect(observable.options.fetchPolicy).toBe('cache-only');

setTimeout(resolve, 50);

} else {
reject(`too many results (${count})`);
}
});
});
});

describe('cache-and-network', function() {
itAsync('gives appropriate networkStatus for refetched queries', (resolve, reject) => {
const client = new ApolloClient({
Expand Down