File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -23,20 +23,20 @@ function prepareComments (client, newComments) {
23
23
return fragment
24
24
} ) . filter ( Boolean )
25
25
26
- // count the total number of comments including nested comments
27
- let totalNComments = data . ncomments + freshNewComments . length
26
+ // count the total number of new comments including its nested new comments
27
+ let totalNComments = freshNewComments . length
28
28
for ( const comment of freshNewComments ) {
29
29
totalNComments += ( comment . ncomments || 0 )
30
30
}
31
31
32
32
// update all ancestors
33
33
const ancestors = data . path . split ( '.' )
34
- updateAncestorsCommentCount ( client , ancestors , totalNComments )
34
+ updateAncestorsCommentCount ( client . cache , ancestors , totalNComments )
35
35
36
36
return {
37
37
...data ,
38
38
comments : { ...data . comments , comments : [ ...freshNewComments , ...data . comments . comments ] } ,
39
- ncomments : totalNComments ,
39
+ ncomments : data . ncomments + totalNComments ,
40
40
newComments : [ ]
41
41
}
42
42
}
You can’t perform that action at this time.
0 commit comments