mirror of
https://github.com/wassname/talk.git
synced 2026-07-07 04:48:24 +08:00
have cursor be the date of the oldest comment
This commit is contained in:
@@ -78,9 +78,14 @@ class Embed extends Component {
|
||||
}
|
||||
|
||||
loadMoreComments = () => {
|
||||
|
||||
if (!this.props.asset.comments.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.props.loadMore({
|
||||
limit: 10,
|
||||
cursor: new Date(),
|
||||
cursor: this.props.asset.comments[this.props.asset.comments.length - 1].created_at,
|
||||
asset_id: this.props.asset.id,
|
||||
sort: 'REVERSE_CHRONOLOGICAL'
|
||||
})
|
||||
|
||||
@@ -35,13 +35,14 @@ export const queryStream = graphql(STREAM_QUERY, {
|
||||
asset_id,
|
||||
sort
|
||||
},
|
||||
updateQuery: ({asset}, {fetchMoreResult:{data:{new_top_level_comments}}}) => {
|
||||
const comments = asset.comments.concat(new_top_level_comments);
|
||||
updateQuery: (oldData, {fetchMoreResult:{data:{new_top_level_comments}}}) => {
|
||||
const asset = {
|
||||
...oldData.asset,
|
||||
comments: [...oldData.asset.comments, ...new_top_level_comments]
|
||||
};
|
||||
return {
|
||||
asset: {
|
||||
...asset,
|
||||
comments
|
||||
}
|
||||
...oldData,
|
||||
asset
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
@@ -97,7 +97,7 @@ const SignInContent = ({
|
||||
SignInContent.propTypes = {
|
||||
auth: PropTypes.shape({
|
||||
isLoading: PropTypes.bool.isRequired,
|
||||
error: PropTypes.object,
|
||||
error: PropTypes.string,
|
||||
emailVerificationFailure: PropTypes.bool
|
||||
}).isRequired,
|
||||
fetchSignInFacebook: PropTypes.func.isRequired,
|
||||
|
||||
Reference in New Issue
Block a user