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

Canonization Options Not Passed via Diff #8831

Closed
aj-foster opened this issue Sep 23, 2021 · 0 comments · Fixed by #8832
Closed

Canonization Options Not Passed via Diff #8831

aj-foster opened this issue Sep 23, 2021 · 0 comments · Fixed by #8832

Comments

@aj-foster
Copy link

Intended outcome:

Use the canonizeResults option to manually disable (or, after #8822, manually enable) canonization with the InMemoryCache.

Actual outcome:

While the customized value of canonizeResults is used in most situations, there are edge cases in which the default value of canonizeResults is used instead.

How to reproduce the issue:

Using the following configuration:

new ApolloClient({
    defaultOptions: { watchQuery: { canonizeResults: false } , query: { canonizeResults: false } },
    // ...
  });

If you perform a query that involves InMemoryCache — and specifically, its private broadcastWatch function — then custom values of canonizeResults are not properly passed down.

This is the offending call. The call to diff should pass along c.canonizeResults. This is closely related to work @benjamn is currently doing.

Versions

  System:
    OS: macOS 11.6
  Binaries:
    Node: 12.16.1 - ~/.asdf/installs/nodejs/12.16.1/bin/node
    Yarn: 3.0.2 - ~/Documents/Projects/ps-dev/labs/node_modules/.bin/yarn
    npm: 7.8.0 - ~/.asdf/installs/nodejs/12.16.1/.npm/bin/npm
  Browsers:
    Chrome: 93.0.4577.82
    Safari: 15.0
  npmPackages:
    @apollo/client: ^3.3.21 => 3.4.13 
    react-apollo: ^3.1.5 => 3.1.5 
@benjamn benjamn self-assigned this Sep 23, 2021
benjamn added a commit that referenced this issue Sep 23, 2021
Both `returnPartialData` and `canonizeResults` were missing from this
call. Instead of enumerating the properties, we can take advantage of
the overlap between `WatchOptions` and `DiffOptions` to pass all
properties through, without having to enumerate them explicitly, so this
kind of mistake won't happen again.

Fixes #8831.
benjamn added a commit that referenced this issue Sep 23, 2021
Both `returnPartialData` and `canonizeResults` were missing from this
call. Instead of enumerating the properties, we can take advantage of
the overlap between `WatchOptions` and `DiffOptions` to pass all
properties through, without having to enumerate them explicitly, so this
kind of mistake won't happen again.

Fixes #8831.
benjamn added a commit that referenced this issue Sep 23, 2021
Both `returnPartialData` and `canonizeResults` were missing from this
call. Instead of enumerating the properties, we can take advantage of
the overlap between `WatchOptions` and `DiffOptions` to pass all
properties through, without having to enumerate them explicitly, so this
kind of mistake won't happen again.

Fixes #8831.
@benjamn benjamn added this to the v3.4.x patch releases milestone Sep 24, 2021
benjamn added a commit that referenced this issue Sep 27, 2021
Both `returnPartialData` and `canonizeResults` were missing from this
call. Instead of enumerating the properties, we can take advantage of
the overlap between `WatchOptions` and `DiffOptions` to pass all
properties through, without having to enumerate them explicitly, so this
kind of mistake won't happen again.

Fixes #8831.
benjamn added a commit that referenced this issue Sep 27, 2021
@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.