mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-15 00:37:03 +05:30
fix(common): do not compute a new node if it cannot be used
This commit is contained in:
parent
0083aa69b5
commit
2ab69de686
1 changed files with 1 additions and 2 deletions
|
@ -63,13 +63,12 @@ private fun CommentsPageInternal(
|
||||||
nodes = commentNodes,
|
nodes = commentNodes,
|
||||||
htmlConverter = htmlConverter,
|
htmlConverter = htmlConverter,
|
||||||
toggleExpanded = { node ->
|
toggleExpanded = { node ->
|
||||||
val newNode = toggleAllExpanded(node)
|
|
||||||
// TODO(anunaym14): make this search recursive
|
// TODO(anunaym14): make this search recursive
|
||||||
val index =
|
val index =
|
||||||
commentNodes.indexOf(commentNodes.find { it.comment.url == node.comment.url })
|
commentNodes.indexOf(commentNodes.find { it.comment.url == node.comment.url })
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
commentNodes.removeAt(index)
|
commentNodes.removeAt(index)
|
||||||
commentNodes.add(index, newNode)
|
commentNodes.add(index, toggleAllExpanded(node))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue