Skip to content

Commit

Permalink
[#1] - Just remove useless loadingBar inside mapStateToProps method.
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyLv committed Sep 30, 2016
1 parent 204d646 commit 8343146
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/containers/blog/BlogContentContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ import { fetchArticleIfNeeded } from '../../ducks/article'
import '../../components/Blog/Article.less'

@connect(
({ article, loadingBar }) => ({
({ article }) => ({
meta: article.meta,
content: article.content,
loadingBar
})
)
export default class BlogContentContainer extends Component {
Expand All @@ -23,33 +22,33 @@ export default class BlogContentContainer extends Component {
content: PropTypes.string.isRequired,
dispatch: PropTypes.func.isRequired
}

componentDidMount() {
const { category, id } = this.props.params
this.props.dispatch(fetchArticleIfNeeded(category, id))
}

componentWillReceiveProps(nextProps) {
if (nextProps.params !== this.props.params) {
const { category, id } = nextProps.params
this.props.dispatch(fetchArticleIfNeeded(category, id))
}
}

render() {
const { meta, content } = this.props
const { category, id } = this.props.params
const filename = `_posts/${category}/${id}.md`
const editUrl = `https://github.com/${GITHUB.user}/${GITHUB.repo}/edit/${GITHUB.branch}/${filename}`

document.title = `${meta.title} | ${SUB_TITLE}`

return (
<div className="yue">
<LoadingBar />
<Article {...{ meta, content, editUrl, filename }}/>
<hr/>
<SocialShare meta={meta}/>
<Article {...{ meta, content, editUrl, filename }} />
<hr />
<SocialShare meta={meta} />
</div>
)
}
Expand Down

0 comments on commit 8343146

Please sign in to comment.