MCPcopy
hub / github.com/pomber/didact / commitWork

Function commitWork

didact.js:99–130  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

97}
98
99function commitWork(fiber) {
100 if (!fiber) {
101 return
102 }
103
104 let domParentFiber = fiber.parent
105 while (!domParentFiber.dom) {
106 domParentFiber = domParentFiber.parent
107 }
108 const domParent = domParentFiber.dom
109
110 if (
111 fiber.effectTag === "PLACEMENT" &&
112 fiber.dom != null
113 ) {
114 domParent.appendChild(fiber.dom)
115 } else if (
116 fiber.effectTag === "UPDATE" &&
117 fiber.dom != null
118 ) {
119 updateDom(
120 fiber.dom,
121 fiber.alternate.props,
122 fiber.props
123 )
124 } else if (fiber.effectTag === "DELETION") {
125 commitDeletion(fiber, domParent)
126 }
127
128 commitWork(fiber.child)
129 commitWork(fiber.sibling)
130}
131
132function commitDeletion(fiber, domParent) {
133 if (fiber.dom) {

Callers 1

commitRootFunction · 0.85

Calls 2

updateDomFunction · 0.85
commitDeletionFunction · 0.85

Tested by

no test coverage detected