Comments (14)
I believe the template is supposed to be:
${() => componentRenderer.checksum()}
instead of:
${componentRenderer.checksum()}
from rapscallion.
I believe this was a regression. I'll have a fix (and regression test) out for this tomorrow @marcohamersma. Thanks for the report!
from rapscallion.
Hi there, are there any updates? I'm also down for an ugly hack in the meantime – can't get the checksum running in any way somehow.
from rapscallion.
@divmain I tried to get the .checksum()
from the responseRenderer, but that obviously doesn't work. Then I tried to call componentRenderer.toStream()
manually, but that's not getting anywhere either. The componentRenderer lacks this._stream
, but I have no idea how it should get one if I can't call toStream()
.
Does it mean currently you can't get the checksum feature if you use the responseRenderer
?
from rapscallion.
@tom2strobl @marcohamersma Sorry for the delay on this. Real life interrupted :). Fix is in branch fix-stream-checksums
and published to rapscallion@next
. Would one of you be willing to install and check that this is resolved for you?
from rapscallion.
No worries, this is Open Source and you're doing it for free so there can't be a delay :-)
I tried npm i -S rapscallion@next
which installed 2.1.2
, unfortunately it seems to still persist, here's my (shortened) use case:
const componentRenderer = render(<Component {...data} />);
const responseRenderer = template`
// [...]
<div id="app-mount">${componentRenderer}</div>
// [...]
<script id="app-state">
window.state = ${() => JSON.stringify(data)}
document.querySelector("#app-mount").setAttribute("data-react-checksum", "${componentRenderer.checksum()}")
</script>
`;
const stream = responseRenderer.toStream();
// "this" is in that case a hapi reply interface, so don't worry about it – that part works
this(stream);
It throws:
2017-03-15/10:27:03:041, [error] message: Renderer#checksum can only be invoked for a renderer converted to node stream. stack: Error: Renderer#checksum can only be invoked for a renderer converted to node stream.
at Renderer.checksum (/.../node_modules/rapscallion/lib/renderer.js:56:15)
Am I using it wrong?
from rapscallion.
So... I may have forgotten to npm run build
before publishing 🔨 Try it now, you should see v2.1.3
available under the next
tag.
from rapscallion.
Interesting, it now throws
TypeError: Cannot read property 'toString' of undefined
at Renderer.checksum (/.../node_modules/rapscallion/lib/renderer.js:82:28)
from rapscallion.
Seconded. 2.1.1 throws Renderer#checksum can only be invoked for a renderer converted to node stream.
, 2.1.3 throws Cannot read property 'toString' of undefined
.
from rapscallion.
Can one of you throw up a gist that reproduces? I need something to work against.
from rapscallion.
Shoot, the docs are wrong. Thank you for pointing that out @bmathews. I'll fix that in my branch.
from rapscallion.
@bmathews this and v2.1.3
solved the problem for me
from rapscallion.
Thanks everybody. I move these changes into master and publish to latest
.
from rapscallion.
Published as v2.1.4
.
from rapscallion.
Related Issues (20)
- dangerouslySetInnerHTML fails with arrays
- BC break (regression?): injectDOMPropertyConfig HOT 5
- promise-based rendering. sometimes hangs HOT 9
- TypeError: (("document.querySelector.... is not a function HOT 2
- Invalid non-string/buffer chunk HOT 6
- [Help Needed] Integration with koa based server. HOT 5
- Unhandled rejection TypeError: Unknown node of type: undefined HOT 1
- Support middleware transforms
- It doesnt seem to work with ImmutableJS HOT 6
- Plan to migrate to react@16? HOT 5
- Build without Bluebird? HOT 5
- Warning: render(): Target node has markup rendered by React, but there are unrelated nodes as well. This is most commonly caused by white-space inserted around server-rendered markup. HOT 3
- Runaway promise error when using this library with Bluebird HOT 6
- Can I be of service with React 16? HOT 17
- can i use this with ie9?
- Issue with <select> tags - <select value=""> is not moved to <option selected>
- Async Cache Misses Render Empty or Out of Order HOT 5
- Promise not being Rejected on error? HOT 2
- Discrepancies in attributes rendering
- Is there a redux example for rapscallion? HOT 1
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 rapscallion.