Skip to content

Commit

Permalink
🐛 Fix fetching like stats without creator
Browse files Browse the repository at this point in the history
  • Loading branch information
nwingt committed Aug 13, 2020
1 parent c77cefd commit eaa02fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/models/content/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export const ContentModel = types
}
}),
fetchLikeStat: flow(function * () {
if (!self.creator) return
self.isFetchingLikeStats = true
try {
const result: LikeStatResult = yield self.env.likeCoAPI.fetchContentLikeStat(
Expand Down
4 changes: 3 additions & 1 deletion app/screens/content-view-screen/content-view-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ export class ContentViewScreen extends React.Component<ContentViewScreenProps, {
componentWillUnmount() {
// Update like count incase user has liked the content
const { content } = this.props.navigation.state.params
content.fetchLikeStat()
if (content.shouldFetchLikeStat) {
content.fetchLikeStat()
}
}

private goBack = () => {
Expand Down

0 comments on commit eaa02fc

Please sign in to comment.