parse-community / ParseReact

Seamlessly bring Parse data into your React applications.
https://parseplatform.org
Other
1.3k stars 209 forks source link

React 0.14 and server side render #140

Open 0x0ece opened 8 years ago

0x0ece commented 8 years ago

Repro:

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.
dariye commented 8 years ago

I have the same issue using React Starter Kit

mmazzarolo commented 8 years ago

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)