<commit_before>// FeedData handles all data subscriptions and pushes data down to
// children via props.
//
// This component is a container or 'view controller' and will gather
// any data needed from the domain objects and handle subscriptions
//
// In a future version the children will be able to specify what fields
// they need, however currently they're stored in this component.

/*global FeedList, ReactMeteorData, FeedDomain */

//import CommentContainer from './CommentContainer.jsx'
import {Posts} from '/lib/collections'
import FeedList from '../components/FeedList.jsx'
import {useDeps, composeWithTracker, composeAll} from 'mantra-core'

export const composerfn1 = ({context}, onData) => {

  const fields = {
          _id: true,
          desc: true,
          likeCount: true,
          commentCount: true,
          userName: true,
          createdAt: true,
          ownerId: true,
  }
  let recordCount = 5
//  const recordCount = this.state.recordCount;
  Meteor.subscribe("feed", fields, recordCount);

  postItems: FeedDomain.getAllFeedPosts()

  const {Meteor, Collections} = context()

  if (getMeteorData.feedReady()) {
    sweetAlert("ready")
    const posts = Collections.Posts.find().fetch();
    onData(null, {posts});
  }
};

export const composerfn2 = ({context}, onData) => {

  const fields = {
          _id: true,
          createdAt: true,
          username: true,
          desc: true,
          postId: true,
  }
  const postIds = this.props.postIds
  Meteor.subscribe("feed", fields, postIds);

  const {Meteor, Collections} = context()

  if (getMeteorData.feedReady()) {
    sweetAlert("ready")
    postIds: FeedDomain.getPostCommentIds()
    const posts = Collections.Posts.find().fetch();
    onData(null, {posts});
  }
};

export const depsMapper = (context, actions) => ({
  postIds: Posts.find({}, {fields: {_id: 1}}).map(doc => doc._id),
  context: () => context
});

export default composeAll(
  composeWithTracker(composerfn1),
  composeWithTracker(composerfn2),
  useDeps(depsMapper),
)(FeedList)<commit_msg>final code might look something like this<commit_after>// FeedData handles all data subscriptions and pushes data down to
// children via props.
//
// This component is a container or 'view controller' and will gather
// any data needed from the domain objects and handle subscriptions
//
// In a future version the children will be able to specify what fields
// they need, however currently they're stored in this component.

/*global FeedList, ReactMeteorData, FeedDomain */

//import CommentContainer from './CommentContainer.jsx'
import {Posts, Comments} from '/lib/collections'
import {Meteor} from 'meteor/meteor';
import FeedList from '../components/FeedList.jsx'
import {useDeps, composeWithTracker, composeAll} from 'mantra-core'

export const composerfn1 = ({context}, onData) => {

  const fields = {
          _id: true,
          desc: true,
          likeCount: true,
          commentCount: true,
          userName: true,
          createdAt: true,
          ownerId: true,
  }
  let recordCount = 5
//  const recordCount = this.state.recordCount;
  if (Meteor.subscribe("feed", fields, recordCount).ready()) {
    sweetAlert("ready")
    const posts = Collections.Posts.find().fetch();
    onData(null, {posts});
  }
};

export const composerfn2 = ({context}, onData) => {

  const fields = {
          _id: true,
          createdAt: true,
          username: true,
          desc: true,
          postId: true,
  }
  if (Meteor.subscribe("feed", fields, postIds).ready()) {
    sweetAlert("ready")
    postIds: FeedDomain.getPostCommentIds()
    const comments = Collections.Comments.find().fetch();
    onData(null, {comments});
  }
};

export const depsMapper = (context, actions) => ({
  postIds: Posts.find({}, {fields: {_id: 1}}).map(doc => doc._id),
  context: () => context
});

export default composeAll(
  composeWithTracker(composerfn1),
  composeWithTracker(composerfn2),
  useDeps(depsMapper),
)(FeedList)
{'fraction_non_alphanumeric': 0.12503125781445362, 'fraction_numerical': 0.003000750187546887, 'mean_word_length': 3.314994606256742, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4541318', 'n_tokens_mistral': 1214, 'n_tokens_neox': 1156, 'n_words': 355}