Skip to content

Commit cbcea20

Browse files
committed
Fix naming for node current and past state
1 parent e3b81f3 commit cbcea20

File tree

1 file changed

+12
-12
lines changed
  • workflow-trace-viewer/src/jvmMain/kotlin/com/squareup/workflow1/traceviewer/ui

1 file changed

+12
-12
lines changed

workflow-trace-viewer/src/jvmMain/kotlin/com/squareup/workflow1/traceviewer/ui/WorkflowTree.kt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ internal fun RenderTrace(
124124
val previousFrame = if (frameInd > 0) fullTree[frameInd - 1] else null
125125
DrawTree(
126126
node = fullTree[frameInd],
127-
previousNode = previousFrame,
127+
previousFrameNode = previousFrame,
128128
affectedNodes = affectedNodes[frameInd],
129129
expandedNodes = remember(frameInd) { mutableStateMapOf() },
130130
onNodeSelect = onNodeSelect,
@@ -142,7 +142,7 @@ internal fun RenderTrace(
142142
@Composable
143143
private fun DrawTree(
144144
node: Node,
145-
previousNode: Node?,
145+
previousFrameNode: Node?,
146146
affectedNodes: Set<Node>,
147147
expandedNodes: MutableMap<String, Boolean>,
148148
onNodeSelect: (Node, Node?) -> Unit,
@@ -163,11 +163,11 @@ private fun DrawTree(
163163
val isExpanded = expandedNodes[node.id] == true
164164

165165
DrawNode(
166-
node,
167-
previousNode,
168-
isAffected,
169-
isExpanded,
170-
onNodeSelect,
166+
node = node,
167+
nodePast = previousFrameNode,
168+
isAffected = isAffected,
169+
isExpanded = isExpanded,
170+
onNodeSelect = onNodeSelect,
171171
onExpandToggle = { expandedNodes[node.id] = !expandedNodes[node.id]!! }
172172
)
173173

@@ -182,11 +182,11 @@ private fun DrawTree(
182182
In the edge case that the current frame has additional children compared to the previous
183183
frame, we replace with null and will check before next recursive call.
184184
*/
185-
node.children.forEach { (index, childNode) ->
186-
val prevChildNode = previousNode?.children?.get(index)
185+
node.children.forEach { (id, childNode) ->
186+
val prevFrameChildNode = previousFrameNode?.children?.get(id)
187187
DrawTree(
188188
node = childNode,
189-
previousNode = prevChildNode,
189+
previousFrameNode = prevFrameChildNode,
190190
affectedNodes = affectedNodes,
191191
expandedNodes = expandedNodes,
192192
onNodeSelect = onNodeSelect
@@ -204,7 +204,7 @@ private fun DrawTree(
204204
@Composable
205205
private fun DrawNode(
206206
node: Node,
207-
previousNode: Node?,
207+
nodePast: Node?,
208208
isAffected: Boolean,
209209
isExpanded: Boolean,
210210
onNodeSelect: (Node, Node?) -> Unit,
@@ -215,7 +215,7 @@ private fun DrawNode(
215215
.background(if (isAffected) Color.Green else Color.Transparent)
216216
.onPointerEvent(PointerEventType.Press) {
217217
if (it.buttons.isPrimaryPressed) {
218-
onNodeSelect(node, previousNode)
218+
onNodeSelect(node, nodePast)
219219
} else if (it.buttons.isSecondaryPressed) {
220220
onExpandToggle(node)
221221
}

0 commit comments

Comments
 (0)