Remove QueryKeyMaker abstraction. #4245
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
QueryKeyMaker
was first introduced (by me) in #3394 in order to cache the same result for different query objects (or different objects within different queries), provided the objects had identical structure.It's nice to be able to assume that (sub)queries with equivalent structure share the same object identities, but the cache will work without that assumption, and enforcing that discipline is not free, in terms of runtime cost, implementation complexity, and of course bundle size.
In the future, the
graphql-tag
tag package could provide a version of thegql
template tag function that returns immutable structures that share object identity where possible. By doing that work at query parsing time, we could achieve the same goal without needing theQueryKeyMaker
.This commit alone saves 450ish bytes after minification and gzip!