GithubHelp home page GithubHelp logo

Comments (18)

zpao avatar zpao commented on July 27, 2024

It could be related to heroku's environment. AFAIK Rails uses uglifyjs to do it's minification so it may have something to do with that. static is a reserved keyword, but it's supposed to be safe to use as an object key (except in old IE).

If you don't mind, would you be able to paste the rest of app/assets/javascripts/likes.js.jsx?

from react-rails.

rafael avatar rafael commented on July 27, 2024

Sure,

Here is the likes jsx file:

/** @jsx React.DOM */

var LikeElement = React.createClass({
  getInitialState: function() {
    return { liked: this.props.liked,
             count: this.props.count,
             resource_type: this.props.resource_type,
             resource_id: this.props.resource_id };
  },
  handleClick: function(event) {
    var type = this.state.liked ? 'DELETE' : 'POST';
    $.ajax({
      url: this.props.url,
      type: type,
      dataType: 'json',
      data: { like: { resource_id: this.state.resource_id, resource_type: this.state.resource_type } },
      mimeType: 'textPlain',
      success: function(data) {
        this.setState({count: data['count']});
      }.bind(this)
    });
    this.setState({liked: !this.state.liked});
  },
  render: function() {
    var text = this.state.liked ? 'unlike' : 'like';
    return (
        <div>
          <div> {this.state.count} people likes this </div>
          <span onClick={this.handleClick}>
          {text}
          </span>
        </div>
    );
  }
});

from react-rails.

rafael avatar rafael commented on July 27, 2024

I think is the version of node that heroku uses to compile the assets. In my local I have node 0.8.4 and they are using 0.4.

The only workaround that I've found so far, is to not compile the assets in heroku... But this approach is far from ideal.

from react-rails.

zpao avatar zpao commented on July 27, 2024

Oh sorry, this is actually in JSXTransformer.js and coming from a line in esprima...

Not sure how much we can do about this apart from making a change to esprima to put quotes around static. But that's fragile.

I was going to ask if you knew which version... I tested back to 0.6 but 0.4 is ancient... 😦

from react-rails.

rafael avatar rafael commented on July 27, 2024

Yeah, I agree, that doesn't sound like the right solution.

I would love to have a way to tell @heroku which version of node to use, but I haven't found one :(

Thanks a lot anyways!

from react-rails.

zeke avatar zeke commented on July 27, 2024

Hey @hone and @schneems, do you know how to specify the node version that's used by sprockets here?

from react-rails.

hone avatar hone commented on July 27, 2024

Unfortunately, there currently isn't one. I'm not sure there's a standard with ruby apps on how to specify your node version. I've been told node as a whole can be pretty volatile which is why we haven't been aggressively upgrading.

from react-rails.

vjeux avatar vjeux commented on July 27, 2024

Node v0.4.3 (first release on their blog) was released Sat, 19 Mar 2011. Two and a half years ago. I'm pretty sure that the latest versions of node are more stable.

from react-rails.

schneems avatar schneems commented on July 27, 2024

Are there speed improvements in node in later releases by any chance?

from react-rails.

zpao avatar zpao commented on July 27, 2024

How do you handle node apps in the rest of the cedar stack? Based on https://devcenter.heroku.com/articles/nodejs-support#versions I should be able to specify the node version I want in my package.json. Would it be crazy to follow the same pattern for ruby apps? Honestly I'd be happy with anything > 0.4.x. That branch is ~2.5 years old

I also found https://github.com/heroku/heroku-buildpack-ruby, which mentions being able to build and vendor your own version of node. However without hosting our own buildpack, that's prohibitively difficult for most people.

Are there speed improvements in node in later releases by any chance?

Pretty sure! I haven't followed closely but IIRC 0.4 was before they switched to using libuv. So at the very least, they rewrote all of their platform abstraction code. V8 in 0.4.9 (looks like last 0.4.x version to get V8 update) was 3.1.8.25. 0.10.8 has v8 @ 3.14.5.9. That's meaningless to me, so I guess if we instead just say that there are 2+ years of V8 improvements in there, there are speed improvements from that alone.

from react-rails.

zpao avatar zpao commented on July 27, 2024

Hey guys, we had another person run into this issue yesterday. Is there any update or suggestion we can start making for these people?

from react-rails.

schneems avatar schneems commented on July 27, 2024

We are tracking this in another issue in our issue tracker heroku/heroku-buildpack-ruby#140

In the mean time you may have to fork the ruby buildpack

Richard Schneeman
http://heroku.com
@schneems

Sent from the road

On Friday, August 30, 2013 at 1:48 PM, Paul O’Shannessy wrote:

Hey guys, we had another person run into this issue yesterday. Is there any update or suggestion we can start making for these people?


Reply to this email directly or view it on GitHub (#9 (comment)).

from react-rails.

zpao avatar zpao commented on July 27, 2024

Thanks for the update @schneems!

from react-rails.

zpao avatar zpao commented on July 27, 2024

We're addressing this in the React repo by running an extra transform over JSXTransformer to quote things for ancient versions of node - facebook/react#1097

from react-rails.

scpike avatar scpike commented on July 27, 2024

@zpao This worked for me on heroku with the default ruby buildpack. Thanks for the awesome library!

from react-rails.

jtmalinowski avatar jtmalinowski commented on July 27, 2024

I'll test this in a few days, seems like no one has confirmed the problem since last month.

from react-rails.

sophiebits avatar sophiebits commented on July 27, 2024

Yeah, this should work since React 0.9.

from react-rails.

zpao avatar zpao commented on July 27, 2024

Ah yes, this is confirmed to be working in the linked heroku issue. Thanks @spicyj for the fix :)

from react-rails.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.