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.3.0 #7015

Merged
merged 137 commits into from
Nov 24, 2020
Merged

Release 3.3.0 #7015

merged 137 commits into from
Nov 24, 2020

Conversation

benjamn
Copy link
Member

@benjamn benjamn commented Sep 14, 2020

Like the Release 3.2.0 PR, this PR will serve to collect significant new features, deprecation warnings, and minor breaking changes that we intend to release in @apollo/client@3.3.0.

If you want to test these changes, run

npm i @apollo/client@3.3.0-beta.n

in your application, where the n in -beta.n comes from the most recent commit message like

Bump @apollo/client npm version to 3.3.0-beta.n.

Until v3.3.0 is released, we can continue merging smaller changes into main and releasing them, without worrying about larger changes on the release-3.3 branch.

benjamn and others added 12 commits September 14, 2020 14:47
There's no harm in returning an empty TypePolicy object for an
unrecognized type name, so we can simplify this code by removing the
option to prevent initial policy creation.

Future commits will allow type policies to be inherited according to
possibleTypes, which means an intermediate subtype can have inherited
policies even if it does not have its own entry in typePolicies. It will
be simpler to implement that behavior if we always initialize the policy
the first time we call getTypePolicy for a particular type.
Passing typePolicies to the InMemoryCache constructor is something that
typically happens during application startup, so it's important that the
processing of typePolicies does not become a performance problem.

Fortunately, we don't have to do all the processing of typePolicies until
we actually look up a given type policy for the first time, which might
occur much later in the lifetime of the application for some types.

Once we implement inheritance of typePolicies, there will often be
supertype-subtype relationships among the types listed in typePolicies.
Without the laziness introduced by this commit, it would be necessary
either to keep typePolicies in supertypes-before-subtypes (topological)
order, or for addTypePolicies somehow to sort the types topologically.

Fortunately, that careful ordering/sorting becomes completely unnecessary
thanks to the laziness, because none of the types can be used until all of
them have been registered.
Support inheritance of typePolicies, according to possibleTypes.
Instead of recursively searching for FieldValueToBeMerged wrapper objects
anywhere in the incoming data, processSelectionSet and processFieldValue
can build a sparse tree specifying just the paths of fields that need to
be merged, and then applyMerges can use that tree to traverse only the
parts of the data where merge functions need to be called.

These changes effectively revert #5880, since the idea of giving merge
functions a chance to transform their child data before calling nested
merge functions no longer makes as much sense. Instead, applyMerges will
be recursively called on the child data before parent merge functions run,
the way it used to be (before #5880).
We know what these functions do, so we can detect them by reference and
then just do what they would have done, without creating a complete
options object or actually calling mergeTrueFn or mergeFalseFn.
@benjamn benjamn mentioned this pull request Nov 17, 2020
2 tasks
benjamn and others added 19 commits November 18, 2020 14:43
In the context of a larger cache read operation, accessing a reactive
variable automatically associates the variable with the cache, so future
updates to the variable can be broadcast to the cache.

Outside this context, it may not be possible for the variable to discover
the currently active cache. For example, there is no currently active
cache in asynchronous ApolloLink code (#7338).

Since we recently added a `reactiveVar.forgetCache(cache)` in #7279, I
think it makes sense to have a manual way to do the opposite, which I have
decided to call `reactiveVar.attachCache(cache)`.

Although this attachment is manual at the moment, in a hypothetical future
where the client/cache manage the persistence of reactive variables, it
should be easy to attach the appropriate cache to those variables when
they are first initialized, which would enable reactive updates from
literally anywhere, with no additional effort by the developer.
Follow-up to #7094, to avoid enabling validation by default, since
@apollo/client@3.3.0 is not a major release.
This allows us to publish v3.3.0 without triggering a ton of updates just
yet. When we're ready, we will switch the tag from `next` to `latest`.
@benjamn benjamn merged commit 29d41eb into main Nov 24, 2020
@benjamn benjamn mentioned this pull request Dec 1, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.