git ssb

1+

Matt McKegg / mutant



Commit 073f2ca837054c3b04113dd573e1a9e8b0c6ed29

map: trigger onRemove immediately after invalidateOn

Matt McKegg committed on 11/17/2016, 5:34:15 AM
Parent: 0db3abb5a74409fcebb43f55d2aa8280583ce4f3

Files changed

map.jschanged
map.jsView
@@ -192,19 +192,23 @@
192192 }
193193 }
194194
195195 function invalidate (entry) {
196- var changed = false
196 + var changed = []
197197 var length = getLength(obs)
198198 lastValues.delete(entry.item)
199199 for (var i = 0; i < length; i++) {
200200 if (get(obs, i) === entry.item) {
201- updateItem(i)
202- changed = true
201 + changed.push(i)
203202 }
204203 }
205- if (changed) {
206- Array.from(rawSet.values()).filter(notIncluded, raw).forEach(removeMapped)
204 + if (changed.length) {
205 + var rawValue = raw[changed[0]]
206 + changed.forEach((index) => { raw[index] = null })
207 + if (!raw.includes(rawValue)) {
208 + removeMapped(rawValue)
209 + }
210 + changed.forEach(updateItem)
207211 binder.broadcast()
208212 }
209213 }
210214

Built with git-ssb-web