Comments (18)
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.
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.
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.
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.
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.
Hey @hone and @schneems, do you know how to specify the node version that's used by sprockets here?
from react-rails.
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.
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.
Are there speed improvements in node in later releases by any chance?
from react-rails.
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.
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.
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.
Thanks for the update @schneems!
from react-rails.
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.
@zpao This worked for me on heroku with the default ruby buildpack. Thanks for the awesome library!
from react-rails.
I'll test this in a few days, seems like no one has confirmed the problem since last month.
from react-rails.
Yeah, this should work since React 0.9.
from react-rails.
Ah yes, this is confirmed to be working in the linked heroku issue. Thanks @spicyj for the fix :)
from react-rails.
Related Issues (20)
- `ReactDOM.version?.split` not transpiled? HOT 3
- Can't resolve 'react-dom/client' HOT 3
- Import react_component but it' shown HOT 2
- compare/contrast and migration steps to react_on_rails HOT 5
- Component doesn't render on jsbundling-rails webpacker HOT 5
- Component not loading in rails app HOT 5
- react-rails v3.1.0 is broken HOT 1
- server_rendering.js not found following README HOT 8
- Re-organize documentations in docs folder
- server_rendering.js not found following README HOT 1
- How do I handle styling?
- esbuild HOT 1
- Error related to server_rendering.js not found with SSR HOT 3
- Setup StrictMode for components HOT 2
- get started docs r-r version HOT 1
- Rails 7.1 Renders Partial Header HOT 1
- Server side rendering `window` behaves differently than Node.js? HOT 4
- Issues with Loading React Component for Cuprite in Rails 7.1
- Hooks not working due to Invalid Hook Call HOT 2
- Move react_ujs to es module flow
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-rails.