-
Notifications
You must be signed in to change notification settings - Fork 756
fix(prerender) accept string props #268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I tried this out and I'm running into an issue with sprockets now. In particular
being thrown from
This is kind of confusing because it is a call to //= require react that is raising the exception |
wow, is there any more stack trace to that? If it's booting a renderer and trying to prerender, I guess it's coming from here: https://github.com/reactjs/react-rails/blob/master/lib/react/server_rendering/sprockets_renderer.rb#L11 But why would it work fine in the asset pipeline but not in prerender? |
Reproduced on Sprockets 2.8 & 2.12. Oh, I misunderstood: it's coming from the asset pipeline, not from prerender! |
Correct, this is for the client side JS file loaded in the rails layout.
|
Looks like this was touched recently in I didn't notice it before because I was on sprockets 3 :S |
@mchristen sounds like a sprockets-rails 2.3.1 issue, see this comment: rails/sprockets-rails#247 (comment) |
It definitely occurs prior to that version as well(at least as early as 2.2.4). When I first ran into the error I came across that issue on sprocket-rails and saw that code was touched with 2.3.1 so I updated to that version to see if the problem went away. When the problem persisted is when I made the comment above. Either way it looks like there will be a fix shortly, thanks for the work! |
aiiiyayay well the regression test for this particular issue passes, so i'm gonna go for it |
fix(prerender) accept string props
@mchristen they've shipped
Please let me know if you can confirm/deny, if we're clear with the latest sprockets-rails I want to get ready for a new version release :D |
My first API was shoving
prerender:
into the props hash, but obviously that doesn't work if props isn't a hash!So instead, pass
prerender_options
along through the ServerRendering pipeline. In theory, a render could take any options.SprocketsRenderer
looks for:static
, to useReact.renderToStaticMarkup