createContainer on server side


#1

Hi community,

I would like show my posts with createContainer from server side. So far, no problem ^^

My problem is when my page loaded : my posts are displayed but after client is loader, my code execute new request for display my post :

The state loading is true (However, the posts were loaded on the server side) and after a few moments, the posts is displayed a new time.

export default createContainer(() => {
  const postsHandle = Meteor.isClient ? Meteor.subscribe('post') : null;
  const loading = Meteor.isClient ? !postsHandle.ready() : false;
  const postsList = Post.find({ 'draft': false }).fetch();
  const listExists = !loading && !!postsList;
  return {
    loading,
    listExists,
    posts: listExists ? postsList : [],
  };
}, PostList);

I don’t really understand why i’ve this “double request”, because my posts are loader in server side :/.
Anyone have idea ?

Thank you community !