profile
viewpoint

Ask questionscurrentObservable.query.getCurrentResult is not a function

<!-- Thanks for filing an issue on React Apollo!

Please make sure that you include the following information to ensure that your issue is actionable.

If you don't follow the template, your issue may end up being closed without anyone looking at it carefully, because it is not actionable for us without the information in this template.

PLEASE NOTE: Feature requests and non-bug related discussions are no longer managed in this repo. Feature requests should be opened in https://github.com/apollographql/apollo-feature-requests. -->

Intended outcome: I was trying to upgrade to the new 3.0.0-beta.2 with this repo:

https://github.com/mfpiccolo/react-apollo-realworld-example-app <!-- What you were trying to accomplish when the bug occurred, and as much code as possible related to the source of the problem. -->

Actual outcome: TypeError: this.currentObservable.query.getCurrentResult is not a function

FullTrace:

react-hooks.esm.js:201 Uncaught TypeError: this.currentObservable.query.getCurrentResult is not a function
    at QueryData../node_modules/@apollo/react-hooks/lib/react-hooks.esm.js.QueryData.getQueryResult (react-hooks.esm.js:201)
    at finish (react-hooks.esm.js:79)
    at QueryData../node_modules/@apollo/react-hooks/lib/react-hooks.esm.js.QueryData.execute (react-hooks.esm.js:84)
    at useQuery (react-hooks.esm.js:293)
    at Query (react-components.esm.js:7)
    at renderWithHooks (react-dom.development.js:12938)
    at mountIndeterminateComponent (react-dom.development.js:15020)
    at beginWork (react-dom.development.js:15625)
    at performUnitOfWork (react-dom.development.js:19312)
    at workLoop (react-dom.development.js:19352)
    at HTMLUnknownElement.callCallback (react-dom.development.js:149)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:199)
    at invokeGuardedCallback (react-dom.development.js:256)
    at replayUnitOfWork (react-dom.development.js:18578)
    at renderRoot (react-dom.development.js:19468)
    at performWorkOnRoot (react-dom.development.js:20342)
    at performWork (react-dom.development.js:20254)
    at performSyncWork (react-dom.development.js:20228)
    at requestWork (react-dom.development.js:20097)
    at scheduleWork (react-dom.development.js:19911)
    at scheduleRootUpdate (react-dom.development.js:20572)
    at updateContainerAtExpirationTime (react-dom.development.js:20600)
    at updateContainer (react-dom.development.js:20657)
    at ReactRoot../node_modules/react-dom/cjs/react-dom.development.js.ReactRoot.render (react-dom.development.js:20953)
    at react-dom.development.js:21090
    at unbatchedUpdates (react-dom.development.js:20459)
    at legacyRenderSubtreeIntoContainer (react-dom.development.js:21086)
    at Object.render (react-dom.development.js:21155)
    at Object../src/index.js (index.js:8)
    at __webpack_require__ (bootstrap e3bb803e2743b8353815:678)
    at fn (bootstrap e3bb803e2743b8353815:88)
    at Object.0 (tokenStorage.js:3)
    at __webpack_require__ (bootstrap e3bb803e2743b8353815:678)
    at bootstrap e3bb803e2743b8353815:724
    at bootstrap e3bb803e2743b8353815:724
index.js:2178 The above error occurred in the <Query> component:
    in Query (at WithViewer.js:28)
    in WithViewer (at Menu.js:8)
    in ul (at Menu.js:7)
    in Menu (at Header.js:9)
    in div (at Header.js:7)
    in nav (at Header.js:6)
    in Header (at Page.js:10)
    in Page (at Home.js:29)
    in Home (created by Context.Consumer)
    in ApolloConsumer (created by withApollo(Home))
    in withApollo(Home) (created by Route)
    in Route (at App.js:19)
    in Switch (at App.js:18)
    in Router (created by BrowserRouter)
    in BrowserRouter (at App.js:16)
    in ApolloProvider (at App.js:15)
    in App (at src/index.js:8)

<!-- A description of what actually happened, including a screenshot or copy-paste of any related error messages, logs, or other output that might be related. Places to look for information include your browser console, server console, and network logs. Please avoid non-specific phrases like “didn’t work” or “broke”. -->

How to reproduce the issue: Clone the project, npm i && npm start <!-- If possible, please create a reproduction using https://github.com/apollographql/react-apollo-error-template and link to it here. If you prefer an in-browser way to create reproduction, try: https://codesandbox.io/s/apollo-client-error-template-7762p

Instructions for how the issue can be reproduced by a maintainer or contributor. Be as specific as possible, and only mention what is necessary to reproduce the bug. If possible, try to isolate the exact circumstances in which the bug occurs and avoid speculation over what the cause might be. -->

Version 3.0.0-beta.2 <!-- Run the following command in your project directory, and paste its (automatically copied to clipboard) results here:

npx envinfo@latest --preset apollo --clipboard -->

apollographql/react-apollo

Answer questions mfpiccolo

2.6.3 does indeed fix it. Thanks. I will leave this open due to 2.5.7 issue @GreenGremlin mentioned.

useful!
source:https://uonfu.com/
Github User Rank List