Open DrJest opened 8 years ago
Found an issue where the loaded_post_count
wasn't getting incremented in case the feed.render()
call failed, thus failing the equality check between it and posts_to_load_count
when attempting to call fireCallback
. Example: if one of the posts fetched was a duplicate.
Fixed it by adding the following (using twitter as an example)
// js/jquery.socialfeed.js line 264
var post = new SocialFeedPost('twitter', Feed.twitter.utility.unifyPostData(element));
var render_successful = post.render();
// If we do not render the post because it was a duplicate or something, reduce the
// completion counter so that the `loaded_post_count` and `posts_to_load_count` resolve to equal
if(!render_successful)
posts_to_load_count--
there was already a fix that works perfectly, for example for twitter https://github.com/pavelk2/social-feed/pull/173/commits/1fe5903edff00946684fb210d5ac1afd6540aa90:
getPosts: function(json) {
if (json) {
// fix callback render
if(json.length<options.twitter.limit) posts_to_load_count -= options.twitter.limit - json.length;
$.each(json, function() {
var element = this;
var post = new SocialFeedPost('twitter', Feed.twitter.utility.unifyPostData(element));
post.render();
});
}
},
Fixes an issue with callback not being fired if there are not enough post in the feed to reach the limit. Also fixes an error if pinterest response is empty