Skip to content

Commit 7bed40c

Browse files
(added) condition in linkFiber if state.node prop has setAttribute method available
coauthor by Sanjay Lavingia <[email protected]>
1 parent 992238b commit 7bed40c

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

src/backend/linkFiber.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -187,16 +187,6 @@ function createTree(
187187
if (!currentFiber) return null;
188188
if (!tree) return tree;
189189

190-
if (currentFiber.tag === 0 || currentFiber.tag === 1 || currentFiber.tag === 2) {
191-
if (currentFiber.child && currentFiber.child.stateNode) {
192-
// console.log('Sanjays algo', currentFiber)
193-
rtid = "fromLinkFiber" + rtidCounter
194-
// if (currentFiber.child.stateNode.setAttribute) {
195-
currentFiber.child.stateNode.setAttribute("id", rtid);
196-
// }
197-
}
198-
rtidCounter++;
199-
}
200190

201191
// These have the newest state. We update state and then
202192
// called updateSnapshotTree()
@@ -399,7 +389,7 @@ function createTree(
399389
pointer = pointer.child
400390
}
401391
} else {
402-
if (currentFiber.child && currentFiber.child.stateNode) {
392+
if (currentFiber.child && currentFiber.child.stateNode && currentFiber.child.stateNode.setAttribute) {
403393
rtid = "fromLinkFiber" + rtidCounter
404394
currentFiber.child.stateNode.setAttribute("id", rtid);
405395
}
@@ -431,7 +421,7 @@ function createTree(
431421
pointer = pointer.child
432422
}
433423
} else {
434-
if (currentFiber.child && currentFiber.child.stateNode) {
424+
if (currentFiber.child && currentFiber.child.stateNode && currentFiber.child.stateNode.setAttribute) {
435425
rtid = "fromLinkFiber" + rtidCounter
436426
currentFiber.child.stateNode.setAttribute("id", rtid);
437427
}

0 commit comments

Comments
 (0)