Skip to content

Commit af266b3

Browse files
author
pemrouz
committed
fix: just queue change objects during batch
1 parent 08a4844 commit af266b3

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/index.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,19 @@ const resource = ripple => name => {
6060
}
6161

6262
// batch renders on render frames
63-
const batch = ripple => el => el.pending
64-
? el.pending.push(ripple.change)
65-
: (el.pending = [ripple.change]
66-
, requestAnimationFrame(d => {
67-
el.change = el.pending
63+
const batch = ripple => el => {
64+
if (!el.pending) {
65+
el.pending = []
66+
requestAnimationFrame(d => {
67+
el.changes = el.pending
6868
delete el.pending
6969
ripple.render(el)
70-
}))
70+
})
71+
}
72+
73+
if (ripple.change)
74+
el.pending.push(ripple.change[1])
75+
}
7176

7277
// main function to render a particular custom element with any data it needs
7378
const invoke = ripple => el => {

0 commit comments

Comments
 (0)