parse-community / ParseReact

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

ParseReact.currentUser not refreshing #180

Open matthewfcarlson opened 7 years ago

matthewfcarlson commented 7 years ago

I'm running into some issues getting the anyBudget demo code to function. I've deployed a Parse backend to Heroku, which is running fine (2.2.18). It is configured to serve the static JS, CSS, and html files (which are bundled with browserify). In the login wrapper, I can see that the observe is getting set and the subscription is being passed back. I can see the login request going out to parse and coming back successfully with the correct data. I can request Parse.User.current() and get the current user. The real problem comes from this.data.user in the render function. Relevant code snippets included.

observe: function() {
    return {
      user: ParseReact.currentUser
    };
  },

  render: function() {
    if (this.data.user) {
      return (
        <div>
          <a class...
agent3bood commented 7 years ago

I was doing the same now and its working for me. here are my versions "dependencies": { "parse": "^1.6.14", "parse-react": "^0.5.2", "react": "^15.3.2", "react-dom": "^15.3.2" },

and my code

observe(props, state){ return{ user: ParseReact.currentUser } } componentDidMount(){ Parse.User.logIn("user", "user", { success: function(user) { // Do stuff after successful login. }, error: function(user, error) { // The login failed. Check error to see why. } }); } render() { console.log(this.data.user.objectId); return(){} }

ryuhhnn commented 7 years ago

I'm having this same issue, not quite sure what's up. I will say though, when I run locally, it works like a charm, but as soon as I run my API on a hosted VPS it acts up.