@@ -18,40 +18,24 @@ export function getCommentGroups(
18
18
} )
19
19
}
20
20
} )
21
- console . log (
22
- 'getCommentGroups: Initial groups after filtering root comments:' ,
23
- groups ,
24
- )
25
21
26
22
groups . forEach ( ( group ) => {
27
- console . log ( `Processing group with id ${ group . id } ` )
28
23
let comment : HMComment | null = group . comments [ 0 ]
29
24
while ( comment ) {
30
25
const nextComments = comments ?. filter (
31
26
( c ) => c . replyParent === comment ?. id ,
32
27
)
33
- console . log (
34
- `Found ${ nextComments ?. length || 0 } direct replies to comment ${
35
- comment . id
36
- } `,
37
- )
38
28
39
29
if ( nextComments ?. length === 1 ) {
40
30
comment = nextComments [ 0 ]
41
31
group . comments . push ( comment )
42
- console . log (
43
- `getCommentGroups: Added comment ${ comment . id } to group ${ group . id } ` ,
44
- )
45
32
} else {
46
33
comment = null
47
34
}
48
35
}
49
36
50
37
const lastGroupComment = group . comments . at ( - 1 )
51
38
if ( ! lastGroupComment || ! comments ) return
52
- console . log (
53
- `getCommentGroups: Finding more comments for lastGroupComment: ${ lastGroupComment . id } ` ,
54
- )
55
39
56
40
const moreComments = new Set < string > ( )
57
41
let walkMoreCommentIds = new Set < string > ( [ lastGroupComment . id ] )
@@ -62,18 +46,10 @@ export function getCommentGroups(
62
46
. filter ( ( c ) => c . replyParent && walkMoreCommentIds . has ( c . replyParent ) )
63
47
. map ( ( comment ) => comment . id ) ,
64
48
)
65
- console . log (
66
- 'getCommentGroups: walkMoreCommentIds:' ,
67
- Array . from ( walkMoreCommentIds ) ,
68
- )
69
49
}
70
50
71
51
group . moreCommentsCount = moreComments . size - 1
72
- console . log (
73
- `getCommentGroups: Group ${ group . id } moreCommentsCount: ${ group . moreCommentsCount } ` ,
74
- )
75
52
} )
76
53
77
- console . log ( 'Final groups:' , groups )
78
54
return groups
79
55
}
0 commit comments