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

getDataFromTree is not a function #47

Closed
18601673727 opened this issue Jul 27, 2019 · 1 comment
Closed

getDataFromTree is not a function #47

18601673727 opened this issue Jul 27, 2019 · 1 comment

Comments

@18601673727
Copy link

Hey there, nice handy lib!

Was trying to running next-apollo-example with modified package.json:

"@apollo/react-common": "0.1.0-beta.9",
"@apollo/react-hooks": "0.1.0-beta.11",
"next-apollo": "^3.0.0",

CSR working, but SSR gives following error:

TypeError: (0 , _reactHooks.getDataFromTree) is not a function
    at _callee$ (/PathTo/next-apollo-example/node_modules/next-apollo/dist/withData.js:91:60)
    at tryCatch (/PathTo/next-apollo-example/node_modules/regenerator-runtime/runtime.js:45:40)
    at Generator.invoke [as _invoke] (/PathTo/next-apollo-example/node_modules/regenerator-runtime/runtime.js:271:22)
    at Generator.prototype.(anonymous function) [as next] (/PathTo/next-apollo-example/node_modules/regenerator-runtime/runtime.js:97:21)
    at asyncGeneratorStep (/PathTo/next-apollo-example/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
    at _next (/PathTo/next-apollo-example/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
    at /PathTo-apollo-example/node_modules/@babel/runtime/helpers/asyncToGenerator.js:32:7
    at new Promise (<anonymous>)
    at Function.<anonymous> (/PathTo/next-apollo-example/node_modules/@babel/runtime/helpers/asyncToGenerator.js:21:12)
    at Function.getInitialProps (/PathTo/next-apollo-example/node_modules/next-apollo/dist/withData.js:135:37)
    at loadGetInitialProps (/PathTo/next-apollo-example/node_modules/next-server/dist/lib/utils.js:50:35)
    at _callee$ (/PathTo/next-apollo-example/.next/server/static/development/pages/_app.js:892:51)
    at tryCatch (/PathTo/next-apollo-example/node_modules/regenerator-runtime/runtime.js:45:40)
    at Generator.invoke [as _invoke] (/PathTo/next-apollo-example/node_modules/regenerator-runtime/runtime.js:271:22)
    at Generator.prototype.(anonymous function) [as next] (/PathTo/next-apollo-example/node_modules/regenerator-runtime/runtime.js:97:21)
    at asyncGeneratorStep (/PathTo/next-apollo-example/.next/server/static/development/pages/_document.js:272:24)

Have done some search, found one potential solution:

-- import { getDataFromTree } from '@apollo/react-hooks' 
++ import { getDataFromTree } from '@apollo/react-ssr' 

apollographql/react-apollo#3251
https://www.npmjs.com/package/@apollo/react-ssr

@adamsoffer
Copy link
Owner

ah thanks for the heads up @18601673727 ! Just pushed up a fix to next-apollo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants