0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-06 12:12:42 +00:00

Brew content will now not server render jsut incase it has malformed html, so it wont break the page

This commit is contained in:
Scott Tolksdorf
2016-05-18 00:20:07 -04:00
parent fc3587d6cb
commit 6209fcd5cb
3 changed files with 8 additions and 4 deletions

View File

@@ -15,7 +15,8 @@ var BrewRenderer = React.createClass({
getInitialState: function() {
return {
viewablePageNumber: 0,
height : 0
height : 0,
isMounted : false
};
},
totalPages : 0,
@@ -23,7 +24,8 @@ var BrewRenderer = React.createClass({
componentDidMount: function() {
this.setState({
height : this.refs.main.parentNode.clientHeight
height : this.refs.main.parentNode.clientHeight,
isMounted : true
});
},
handleScroll : function(e){
@@ -36,6 +38,8 @@ var BrewRenderer = React.createClass({
},
shouldRender : function(pageText, index){
if(!this.state.isMounted) return false;
var viewIndex = this.state.viewablePageNumber;
if(index == viewIndex - 1) return true;
if(index == viewIndex) return true;