Commit 875e2041 authored by MrMan's avatar MrMan

currentRec is sometimes null, right after recs have been exhausted

parent 708462e9
......@@ -154,19 +154,19 @@ let RecommendationStore = Reflux.createStore({
},
handleSentimentProcessing(s) {
console.log("[TINDER RECOMMENDATION STORE] Detected successful sentiment processing", s);
// Get the next recommendation if the sentiment was processed
let currentRecMatches = s.userId === this.state.currentRec._id;
if (currentRecMatches) {
this.getNextRecommendation();
} else {
// If the current rec wasn't the right user, ensure that it's removed from the list of recs
this.state.recs = _.filter(this.state.recs, r => r._id !== s.userId);
this.ensureCurrentMatchIsInList(); // In case we get out of sync somehow
this.backupSate();
this.trigger(this.state);
}
console.log("[TINDER RECOMMENDATION STORE] Detected successful sentiment processing", s);
// Get the next recommendation if the sentiment was processed
let currentRecMatches = this.state.currentRec ? (s.userId === this.state.currentRec._id) : false;
if (currentRecMatches) {
this.getNextRecommendation();
} else {
// If the current rec wasn't the right user, ensure that it's removed from the list of recs
this.state.recs = _.filter(this.state.recs, r => r._id !== s.userId);
this.ensureCurrentMatchIsInList(); // In case we get out of sync somehow
this.backupSate();
this.trigger(this.state);
}
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment