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

Check structural equality in QueryInfo#setDiff. #6891

Merged
merged 2 commits into from
Aug 24, 2020

Conversation

benjamn
Copy link
Member

@benjamn benjamn commented Aug 24, 2020

Should help with #6888, which demonstrates that === disagrees with equal in some important cases, even though the cache is often able to provide === results when nothing has changed.

@benjamn benjamn self-assigned this Aug 24, 2020
benjamn added a commit that referenced this pull request Aug 24, 2020
@benjamn benjamn force-pushed the check-structural-equality-in-QueryInfo-setDiff branch from b210438 to 3d5aebd Compare August 24, 2020 23:46
@benjamn benjamn requested a review from StephenBarlow as a code owner August 24, 2020 23:46
@benjamn benjamn changed the base branch from master to release-3.2 August 24, 2020 23:46
@benjamn benjamn merged commit 24a4396 into release-3.2 Aug 24, 2020
@benjamn benjamn deleted the check-structural-equality-in-QueryInfo-setDiff branch August 24, 2020 23:46
benjamn added a commit that referenced this pull request Aug 28, 2020
This reverts commit 24a4396, which
prevented some legitimate updates in https://studio.apollographql.com.
We will have to keep investigating #6888 to find a better solution.
benjamn added a commit that referenced this pull request Apr 16, 2021
Revisiting PR #6891, which was reverted by commit c2ef68f.

With the introduction of canonical cache results (#7439), the strict
equality check in setDiff is about to become mostly synonymous with deep
equality checking (but much faster to check), so we need to deal with the
consequences of #6891 one way or another.

As evidence that this change now (after #7439) has no observable impact,
notice that we were able to switch back to using !equal(a, b) without
needing to fix/update any failing tests, compared to the few tests that
needed updating in #6891.

However, by switching to deep equality checking, we allow ourselves the
option to experiment with disabling (or periodically clearing) the
ObjectCanon, which would presumably lead to broadcasting more !== but
deeply equal results to cache.watch watchers.

With deep equality checking in setDiff, those !== results will get past
the filter in the same cases canonical objects would, so there's less of a
discrepancy in client behavior with/without canonization enabled.
benjamn added a commit that referenced this pull request May 12, 2021
Revisiting PR #6891, which was reverted by commit c2ef68f.

With the introduction of canonical cache results (#7439), the strict
equality check in setDiff is about to become mostly synonymous with deep
equality checking (but much faster to check), so we need to deal with the
consequences of #6891 one way or another.

As evidence that this change now (after #7439) has no observable impact,
notice that we were able to switch back to using !equal(a, b) without
needing to fix/update any failing tests, compared to the few tests that
needed updating in #6891.

However, by switching to deep equality checking, we allow ourselves the
option to experiment with disabling (or periodically clearing) the
ObjectCanon, which would presumably lead to broadcasting more !== but
deeply equal results to cache.watch watchers.

With deep equality checking in setDiff, those !== results will get past
the filter in the same cases canonical objects would, so there's less of a
discrepancy in client behavior with/without canonization enabled.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant