diff --git a/static/js/TextList.jsx b/static/js/TextList.jsx
index ad42065560..61dfe47183 100644
--- a/static/js/TextList.jsx
+++ b/static/js/TextList.jsx
@@ -82,10 +82,11 @@ class TextList extends Component {
this.preloadSingleCommentaryText(filter);
} else if (filter.length == 1 && filter[0] == "Commentary") {
+
this.preloadAllCommentaryText(filter);
} else {
- this.setState({waitForText: false, textLoaded: false});
+ this.setState({waitForText: false, textLoaded: true});
}
}
preloadSingleCommentaryText(filter) {
@@ -95,7 +96,6 @@ class TextList extends Component {
var commentator = filter[0];
var basetext = this.getSectionRef();
var commentarySection = Sefaria.commentarySectionRef(commentator, basetext);
- console.log("commentary text,, ", commentator, basetext, commentarySection);
if (!commentarySection) {
this.setState({waitForText: false});
return;
@@ -103,7 +103,7 @@ class TextList extends Component {
this.setState({waitForText: true});
Sefaria.text(commentarySection, {}, function() {
if (this._isMounted) {
- this.setState({textLoaded: true});
+ this.setState({textLoaded: false});
}
}.bind(this));
}
@@ -118,38 +118,38 @@ class TextList extends Component {
});
if (commentators.length) {
+
var commentarySections = commentators.map(function(commentator) {
+
return Sefaria.commentarySectionRef(commentator, basetext);
}).filter(function(commentarySection) {
return !!commentarySection;
});
this.waitingFor = Sefaria.util.clone(commentarySections);
+
this.target = 0;
for (var i = 0; i < commentarySections.length; i++) {
Sefaria.text(commentarySections[i], {}, function(data) {
var index = this.waitingFor.indexOf(data.commentator);
if (index == -1) {
// console.log("Failed to clear commentator:");
- // console.log(data);
this.target += 1;
}
if (index > -1) {
this.waitingFor.splice(index, 1);
}
- if (this.waitingFor.length == this.target) {
- if (this._isMounted) {
- this.setState({textLoaded: true});
- }
+ if (this._isMounted ) {
+ this.setState({textLoaded: false})
}
}.bind(this));
}
} else {
// All commentaries have been loaded already
- this.setState({textLoaded: true});
+ this.setState({textLoaded: false});
}
} else {
// There were no commentaries to load
- this.setState({textLoaded: true});
+ this.setState({textLoaded: false});
}
}
getLinks() {
@@ -199,7 +199,9 @@ class TextList extends Component {
var filter = this.props.filter; // Remove filterSuffix for display
var displayFilter = filter.map(filter => filter.split("|")[0]); // Remove filterSuffix for display
var links = this.getLinks();
+ var isComplexText = Sefaria.normRef(oref).isComplex
+ var loadingState = isComplexText ? this.state.textLoaded : !this.state.textLoaded
// this.state.waitForText && !this.state.textLoaded
var enText = filter.length ? displayFilter.join(", "): ""
var en = Sefaria._('text.message.no_connection', {text: enText});
@@ -208,7 +210,7 @@ class TextList extends Component {
var noResultsMessage = ;
var message = !this.state.linksLoaded ? () : (links.length === 0 ? noResultsMessage : null);
var content = links.length === 0 ? message :
- this.state.waitForText && this.state.textLoaded ?
+ this.state.textLoaded ?
() :
links.map(function(link, i) {
if (link.isSheet) {