Facebook comments only show sometimes

I’m using the Facebook SDK package http://fastosphere.meteor.com/biasport%3Afacebook-sdk?q=facebook%20

I want to load comments on my page, but they only show up sometimes. The comments show up and work fine when you reload the page/type the url in manually and press enter. But, when you enter the page from a link on a previous page, the comments don’t show up. They show up again when you reload it.

Using React, Flow Router, Kadira:react-layout.

Edited: showing my code now

Comments.jsx

window.fbAsyncInit = function() {
  FB.init({
    appId      : '123456',
    status     : true,
    xfbml      : true,
    version: "v2.5"
  });
};

Comments = React.createClass({
  render() {
    return (
      <div>
        <div
          className="fb-comments"
          data-href="http://www.mysite.com/video/wqYhkbTrFNSS6f9PZ"
          data-width="100%"
          data-colorscheme="light"
          data-numposts="5"></div>
      </div>
    );
  }
});

VideoPage.jsx

...
return (
      <div>
        <div className="container">
          <div className="row centered">
            <div className="col-md-8">
              {this.renderVideo()}
              <div className="hidden-sm hidden-xs">
                <Comments />
              </div>
            </div>
            <div className="col-md-4 hidden-sm hidden-xs">
              {this.renderSuggested()}
            </div>
            <div className="col-md-12 visible-sm visible-xs">
              {this.renderMobileBottomContent()}
            </div>
          </div>
        </div>
      </div>
    );

well, maybe if you paste actual code…

Showing some actual code now.

I dont see where you call FB.XFBML.parse();
What could explain why you only see it once - when the page is rendered before FB SDK is loaded.

1 Like

Hmm where am I supposed to be calling that? I thought that was only for Iron Router, but I can give it a shot. Does it go in the componentDidMount()?

onRendered in Blaze, in React you should know :smiley:

It worked! I put it in componentDidMount(). Thanks a lot! This was killing me the past few days.