Apollo-client: Uncaught (in promise) TypeError: _this.maybeBroadcastWatch.forget is not a function

Created on 14 Oct 2020  ·  3Comments  ·  Source: apollographql/apollo-client

Intended outcome:

no type error

Actual outcome:

Uncaught (in promise) TypeError: _this.maybeBroadcastWatch.forget is not a function
    at QueryInfo.cancel (inMemoryCache.js:134)
    at QueryInfo.../node_modules/@apollo/client/core/QueryInfo.js.QueryInfo.stop (QueryInfo.js:130)
    at QueryManager.../node_modules/@apollo/client/core/QueryManager.js.QueryManager.stopQueryInStoreNoBroadcast (QueryManager.js:302)
    at QueryManager.../node_modules/@apollo/client/core/QueryManager.js.QueryManager.stopQueryNoBroadcast (QueryManager.js:386)
    at QueryManager.../node_modules/@apollo/client/core/QueryManager.js.QueryManager.stopQuery (QueryManager.js:382)
    at QueryManager.js:284
    at <anonymous>

How to reproduce the issue:

not sure, I've loaded up a page with several useQuery hooks. But previous version works flawlessly, so it should be easy to pinpoint the problem to a commit.

Versions

  System:
    OS: Linux 5.4 Ubuntu 20.04.1 LTS (Focal Fossa)
  Binaries:
    Node: 12.14.1 - ~/.nvm/versions/node/v12.14.1/bin/node
    Yarn: 1.22.4 - ~/.yarn/bin/yarn
    npm: 6.13.4 - ~/.nvm/versions/node/v12.14.1/bin/npm
  Browsers:
    Chrome: 86.0.4240.75
    Firefox: 81.0
  npmPackages:
    @apollo/client: 3.2.4 => 3.2.4
    @apollo/link-batch-http: ^2.0.0-beta.3 => 2.0.0-beta.3 
    @apollo/link-context: ^2.0.0-beta.3 => 2.0.0-beta.3 
    @apollo/link-error: ^2.0.0-beta.3 => 2.0.0-beta.3 
    @apollo/link-schema: ^2.0.0-beta.3 => 2.0.0-beta.3 
    @apollo/react-components: ^3.1.5 => 3.1.5 
    @apollo/react-ssr: ^4.0.0 => 4.0.0 
    @apollo/react-testing: ^3.1.4 => 3.1.4 
    apollo-cache-inmemory: ^1.6.6 => 1.6.6 
    apollo-client: ^2.6.10 => 2.6.10 
    apollo-server: ^2.18.2 => 2.18.2 
    apollo-server-express: ^2.18.2 => 2.18.2 
    react-apollo: ^3.1.5 => 3.1.5 

Most helpful comment

Yes that fixed the problem. NPM resolved that dependency badly for me. Could be because we still have an older version of apollo-client in the repo.
Thanks.

All 3 comments

@capaj Try npm install optimism@latest? It should be at version 0.13.0, as required in package.json. See #7157 for more details.

Will try and report back.

Yes that fixed the problem. NPM resolved that dependency badly for me. Could be because we still have an older version of apollo-client in the repo.
Thanks.

Was this page helpful?
0 / 5 - 0 ratings