// @flow
import {createSelector} from 'reselect'

import selectCurrentBundle from './current-bundle'

export default createSelector(
  (state) => state.scenario.feeds,
  selectCurrentBundle,
  (feeds, bundle) => feeds.map((feed) => {
    const bundleFeed = bundle && bundle.feeds
      .find(({feedId}) => feedId === feed.id)
    return bundleFeed
      ? {...feed, name: bundleFeed.name}
      : {...feed, name: feed.checksum}
  })
)

// @flow
import {createSelector} from 'reselect'

import selectCurrentBundle from './current-bundle'

export default createSelector(
  (state) => state.scenario.feeds,
  selectCurrentBundle,
  (feeds, bundle) => feeds.map((feed) => {
    const bundleFeed = bundle && bundle.feeds
      .find(({feedId}) => feedId === feed.id)
    return bundleFeed
      ? {...feed, name: bundleFeed.name}
      : {...feed, name: feed.id}
  })
)

Use feed id instead of checksum as back up feed name.
fix(feeds): Use feed id instead of checksum as back up feed name.
