Skip to content

Commit dfe3c88

Browse files
committed
Fix for shape diffs
1 parent e0d4f71 commit dfe3c88

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

Agent/SessionReplay/ViewCaptors/SwiftUIShapeThingy.swift

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class SwiftUIShapeThingy: SessionReplayViewThingy {
123123
"height": "100%",
124124
"preserveAspectRatio": "none"
125125
],
126-
childNodes: [.element(pathNode)],
126+
childNodes: [],
127127
isSVG: true
128128
)
129129

@@ -132,17 +132,29 @@ class SwiftUIShapeThingy: SessionReplayViewThingy {
132132
id: viewDetails.viewId,
133133
tagName: .div,
134134
attributes: ["id": viewDetails.cssSelector],
135-
childNodes: [.element(svgNode)]
135+
childNodes: []
136136
)
137137
containerNode.attributes["style"] = inlineCSSDescription()
138138

139+
// Return separate AddRecords for each node (container, svg, path)
140+
// rrweb requires each node to be added individually with parent references
139141
let addContainerNode: RRWebMutationData.AddRecord = .init(
140142
parentId: parentNodeId,
141143
nextId: viewDetails.nextId,
142144
node: .element(containerNode)
143145
)
146+
let addSvgNode: RRWebMutationData.AddRecord = .init(
147+
parentId: viewDetails.viewId,
148+
nextId: nil,
149+
node: .element(svgNode)
150+
)
151+
let addPathNode: RRWebMutationData.AddRecord = .init(
152+
parentId: viewDetails.viewId + 2000000,
153+
nextId: nil,
154+
node: .element(pathNode)
155+
)
144156

145-
return [addContainerNode]
157+
return [addContainerNode, addSvgNode, addPathNode]
146158
}
147159

148160
func generateRRWebNode() -> ElementNodeData {

0 commit comments

Comments
 (0)