Skip to content

Commit 8f60a1e

Browse files
committed
Run finalizers on elem diffing
1 parent 3d68ea1 commit 8f60a1e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Halogen/VDom/DOM.purs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,11 @@ buildElem (VDomSpec spec) = render
102102
Elem es2@(ElemSpec ns2 name2 as2) ch2 | Fn.runFn2 eqElemSpec es1 es2 → do
103103
attrs' ← Machine.step attrs as2
104104
let
105-
onThese = Fn.mkFn3 \ix (Tuple step _) vdom → do
105+
onThese = Fn.mkFn3 \ix (Tuple step halt) vdom → do
106106
Step n' m' h' ← step vdom
107107
n ← Fn.runFn2 unsafeChildIx ix node
108108
Fn.runFn2 whenE (not (Fn.runFn2 refEq n' n)) do
109+
halt
109110
Fn.runFn3 replaceChild n' n node
110111
pure (Tuple m' h')
111112
onThis = Fn.mkFn2 \ix (Tuple _ halt) → do
@@ -156,13 +157,14 @@ buildKeyed (VDomSpec spec) = render
156157
Keyed es2@(ElemSpec ns2 name2 as2) ch2 | Fn.runFn2 eqElemSpec es1 es2 → do
157158
attrs' ← Machine.step attrs as2
158159
let
159-
onThese = Fn.mkFn4 \k ix (Quaple _ ix' step _) (Tuple _ vdom) →
160+
onThese = Fn.mkFn4 \k ix (Quaple _ ix' step halt) (Tuple _ vdom) →
160161
if ix == ix'
161162
then do
162163
Step n' m' h' ← step vdom
163164
n ← Fn.runFn2 unsafeChildIx ix node
164-
Fn.runFn2 whenE (not (Fn.runFn2 refEq n' n))
165-
(Fn.runFn3 replaceChild n' n node)
165+
Fn.runFn2 whenE (not (Fn.runFn2 refEq n' n)) do
166+
halt
167+
Fn.runFn3 replaceChild n' n node
166168
pure (Quaple k ix m' h')
167169
else do
168170
Step n' m' h' ← step vdom

0 commit comments

Comments
 (0)