Commit 073f2ca837054c3b04113dd573e1a9e8b0c6ed29
map: trigger onRemove immediately after invalidateOn
Matt McKegg committed on 11/17/2016, 5:34:15 AMParent: 0db3abb5a74409fcebb43f55d2aa8280583ce4f3
Files changed
map.js | changed |
map.js | |||
---|---|---|---|
@@ -192,19 +192,23 @@ | |||
192 | 192 … | } | |
193 | 193 … | } | |
194 | 194 … | ||
195 | 195 … | function invalidate (entry) { | |
196 | - var changed = false | ||
196 … | + var changed = [] | ||
197 | 197 … | var length = getLength(obs) | |
198 | 198 … | lastValues.delete(entry.item) | |
199 | 199 … | for (var i = 0; i < length; i++) { | |
200 | 200 … | if (get(obs, i) === entry.item) { | |
201 | - updateItem(i) | ||
202 | - changed = true | ||
201 … | + changed.push(i) | ||
203 | 202 … | } | |
204 | 203 … | } | |
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) | ||
207 | 211 … | binder.broadcast() | |
208 | 212 … | } | |
209 | 213 … | } | |
210 | 214 … |
Built with git-ssb-web