Skip to content

Fix callback not fired#173

Open
DrJest wants to merge 1 commit intopavelk2:gh-pagesfrom
DrJest:gh-pages
Open

Fix callback not fired#173
DrJest wants to merge 1 commit intopavelk2:gh-pagesfrom
DrJest:gh-pages

Conversation

@DrJest
Copy link

@DrJest DrJest commented Apr 15, 2016

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

Fixes an issue with callback not being fired if there are not enough post in the feed to reach the limit.
HartLarsson added a commit to HartLarsson/social-feed that referenced this pull request Apr 24, 2016
Added Callback fix, see: pavelk2#173
Added new RSS features to read blogs and Rssfeeds with html and pics.
HartLarsson added a commit to HartLarsson/social-feed that referenced this pull request Jul 6, 2016
new rendering system  pavelk2#171
new callback fix pavelk2#173
New RSS implementation to get Images from RSS feed
fix staging_resource for facebook
@nicosuria
Copy link

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--

@HartLarsson
Copy link
Contributor

there was already a fix that works perfectly, for example for twitter 1fe5903:

                    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();
                            });
                        }
                    },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants