Comments (2)
@vcarel are you able to create a unit test to reproduce this issue?
Here is a quick test I wrote...
it("should not generate wrong images URLs", () => {
clearRequireCache();
let renderCount = 0;
/* eslint-disable max-params, no-console*/
reactComponentCache({
components: {
"ImgComponent": {
cacheAttrs: ["url"]
}
}
});
/* eslint-enable max-params, no-console*/
const React = require("react");
const ReactDomServer = require("react-dom/server");
class ImgComponent extends React.Component {
render() {
renderCount++;
return React.createElement(
"div",
null,
React.createElement("img", { src: this.props.url }));
}
}
// Cache Miss
console.log("First Render:", ReactDomServer.renderToString(React.createFactory(ImgComponent)({url: "/static/media/logo.5d5d9eef.svg"})));
expect(renderCount).to.equal(1);
// Cache Hit
console.log("From Cache: ", ReactDomServer.renderToString(React.createFactory(ImgComponent)({url: "/static/media/logo.5d5d9eef.svg"})));
expect(renderCount).to.equal(1);
});
...but the rendered string coming from the cache looks fine:
First Render: <div data-reactid=".2das182g8ao" data-react-checksum="1530602672"><img src="/static/media/logo.5d5d9eef.svg" data-reactid=".2das182g8ao.0"/></div>
From Cache: <div data-reactid=".2ash97u9log" data-react-checksum="2134320484"><img src="/static/media/logo.5d5d9eef.svg" data-reactid=".2ash97u9log.0"/></div>
from react-ssr-optimization.
Hi, actually it was a mistake from my side. My apologize :-)
from react-ssr-optimization.
Related Issues (17)
- Compatibility with Webpack and Babel HOT 3
- difference between electrode-react-ssr-caching? HOT 1
- Cache All Option? HOT 1
- TypeError: Can't add property _instantiateReactComponent, object is not extensible HOT 1
- Cache based on context HOT 2
- Webpack integration HOT 4
- Cached template strings causes issues with escaped strings HOT 1
- Avoid caching a component because of a prop HOT 2
- React streaming HOT 2
- Module is not working with react and react-dom 16.4.0 HOT 3
- Is react and react-dom required in package.json? HOT 2
- Still Maintained?
- Alternative?
- Not compatible with React 15.* HOT 7
- Template Attrs open to XSS
- Feature Request: Allow environment setting REACT_SSR_OPTIMIZATION_ENV with fallback to NODE_ENV HOT 3
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-ssr-optimization.