ParseReact icon indicating copy to clipboard operation
ParseReact copied to clipboard

React 0.14 and server side render

Open 0x0ece opened this issue 9 years ago • 2 comments

Repro:

  • react 0.14
  • parse 1.6.9
  • parse-react 0.5.0
  • simple page with ParseReact.Mixin, observing 1 query (I'm using this as a template for react 0.14: https://github.com/MadeInHaus/react-flux-gulp-starter, e.g. add ParseReact to the about page)

If the page is rendered client side it works (e.g., refresh the home, click on the about page)

If the page is rendered serve side it crashes (e.g., refresh the about page):

/path/to/node_modules/parse/lib/browser/Storage.js:80
      throw new Error('You need to call Parse.initialize before using Parse.');
      ^

Error: You need to call Parse.initialize before using Parse.
    at Object.generatePath (/path/to/node_modules/parse/lib/browser/Storage.js:80:13)
    at Object.currentInstallationId (/path/to/node_modules/parse/lib/browser/InstallationController.js:43:37)
    at Object.request (/path/to/node_modules/parse/lib/browser/RESTController.js:178:35)
    at Object.find (/path/to/node_modules/parse/lib/browser/ParseQuery.js:1138:27)
    at ParseQuery.find (/path/to/node_modules/parse/lib/browser/ParseQuery.js:289:25)
    at Subscription.issueQuery (/path/to/node_modules/parse-react/lib/browser/Subscription.js:145:26)
    at new Subscription (/path/to/node_modules/parse-react/lib/browser/Subscription.js:94:10)
    at Object.subscribeToQuery (/path/to/node_modules/parse-react/lib/browser/SubscriptionManager.js:47:20)
    at ParseQuery.subscribe (/path/to/node_modules/parse-react/lib/browser/ParsePatches.js:53:32)
    at [object Object]._subscribe (/path/to/node_modules/parse-react/lib/browser/Mixin.js:128:47)

Including parse/node partially solve in the sense that it no longer crashes, but observe doesn't work:

The observation value "myquery" is not subscribable. Make sure you are returning the Query, and not fetching it yourself.

0x0ece avatar Nov 25 '15 07:11 0x0ece

I have the same issue using React Starter Kit

dariye avatar Nov 25 '15 13:11 dariye

I'm having the same issue using ES6 ParseComponent and:

"react": "^0.14.0",
"parse": "^1.6.0",
"parse-react": "^0.5.0",

The app works correctly if I navigate to the page, but if I refresh it i get:

Error: Cannot make a request: No definition of XMLHttpRequest was found.
   at dispatch (/home/matteo/dev/tony-backoffice-react/public/js/app/app.node.js:53799:16)
   at Object.ajax (/home/matteo/dev/tony-backoffice-react/public/js/app/app.node.js:53847:6)
   at ParsePromise.<anonymous> (/home/matteo/dev/tony-backoffice-react/public/js/app/app.node.js:53916:30)
   at ParsePromise.wrappedResolvedCallback (/home/matteo/dev/tony-backoffice-react/public/js/app/app.node.js:49007:42)
   at /home/matteo/dev/tony-backoffice-react/public/js/app/app.node.js:49068:36
   at runLater (/home/matteo/dev/tony-backoffice-react/public/js/app/app.node.js:49052:13)
   at ParsePromise.then (/home/matteo/dev/tony-backoffice-react/public/js/app/app.node.js:49067:10)
   at Object.request (/home/matteo/dev/tony-backoffice-react/public/js/app/app.node.js:53909:9)
   at Object.find (/home/matteo/dev/tony-backoffice-react/public/js/app/app.node.js:51682:28)
   at ParseQuery.find (/home/matteo/dev/tony-backoffice-react/public/js/app/app.node.js:50829:26)

mmazzarolo avatar Dec 29 '15 13:12 mmazzarolo