Resolving bug on comment load.

This commit is contained in:
David Jay
2017-02-09 17:56:28 -08:00
parent ddeb28d729
commit 05fcc61c9c
6 changed files with 15 additions and 20 deletions
+1 -5
View File
@@ -88,9 +88,7 @@ class Embed extends Component {
cursor: this.props.asset.comments[this.props.asset.comments.length - 1].created_at,
asset_id: this.props.asset.id,
sort: 'REVERSE_CHRONOLOGICAL'
})
.then((result) => console.log('result', result))
.catch((err) => console.log('err', err));
});
}
render () {
@@ -111,8 +109,6 @@ class Embed extends Component {
return <Spinner />;
}
console.log('Render', this.props.data);
return (
<div style={expandForLogin}>
<div className="commentStream">
+4 -4
View File
@@ -46,8 +46,8 @@ class Stream extends React.Component {
return (
<div>
{
comments.map(comment => {
return <Comment
comments.map(comment =>
<Comment
refetch={refetch}
setActiveReplyBox={this.setActiveReplyBox}
activeReplyBox={this.state.activeReplyBox}
@@ -61,8 +61,8 @@ class Stream extends React.Component {
showSignInDialog={showSignInDialog}
key={comment.id}
reactKey={comment.id}
comment={comment} />;
})
comment={comment} />
)
}
</div>
);
@@ -35,16 +35,13 @@ export const queryStream = graphql(STREAM_QUERY, {
asset_id,
sort
},
updateQuery: (oldData, {fetchMoreResult:{data:{new_top_level_comments}}}) => {
const asset = {
updateQuery: (oldData, {fetchMoreResult:{data:{new_top_level_comments}}}) => ({
...oldData,
asset: {
...oldData.asset,
comments: [...oldData.asset.comments, ...new_top_level_comments]
};
return {
...oldData,
asset
};
}
}
})
});
}
})
@@ -3,5 +3,8 @@
query LoadMoreComments($limit: Int = 5, $cursor: Date, $parent_id: ID, $asset_id: ID, $sort: SORT_ORDER) {
new_top_level_comments: comments(query: {limit: $limit, cursor: $cursor, parent_id: $parent_id, asset_id: $asset_id, sort: $sort}) {
...commentView
replies(limit: 3) {
...commentView
}
}
}
@@ -18,9 +18,9 @@ query AssetQuery($asset_url: String!) {
requireEmailConfirmation
}
commentCount
comments(limit: 2) {
comments(limit: 10) {
...commentView
replies(limit: 2) {
replies(limit: 3) {
...commentView
}
}
-1
View File
@@ -19,7 +19,6 @@ class Stream extends Component {
}
render() {
console.log(this.props);
const {data} = this.props;
return <div>
<button onClick={this.logMeIn.bind(this)}>Login or whatever</button>