Merge branch 'master' into gh-4372

pull/4390/head
Conduitry 6 years ago
commit cf34ad0ec2

@ -4,6 +4,7 @@
* Fix binding to module-level variables ([#4086](https://github.com/sveltejs/svelte/issues/4086)) * Fix binding to module-level variables ([#4086](https://github.com/sveltejs/svelte/issues/4086))
* Disallow attribute/prop names from matching two-way-bound names or `{shorthand}` attribute/prop names ([#4325](https://github.com/sveltejs/svelte/issues/4325)) * Disallow attribute/prop names from matching two-way-bound names or `{shorthand}` attribute/prop names ([#4325](https://github.com/sveltejs/svelte/issues/4325))
* Improve performance of `flush()` by not using `.shift()` ([#4356](https://github.com/sveltejs/svelte/pull/4356))
* Fix code generation error with precedence of arrow functions ([#4384](https://github.com/sveltejs/svelte/issues/4384)) * Fix code generation error with precedence of arrow functions ([#4384](https://github.com/sveltejs/svelte/issues/4384))
## 3.18.1 ## 3.18.1

@ -31,18 +31,23 @@ export function add_flush_callback(fn) {
flush_callbacks.push(fn); flush_callbacks.push(fn);
} }
let flushing = false;
const seen_callbacks = new Set(); const seen_callbacks = new Set();
export function flush() { export function flush() {
if (flushing) return;
flushing = true;
do { do {
// first, call beforeUpdate functions // first, call beforeUpdate functions
// and update components // and update components
while (dirty_components.length) { for (let i = 0; i < dirty_components.length; i += 1) {
const component = dirty_components.shift(); const component = dirty_components[i];
set_current_component(component); set_current_component(component);
update(component.$$); update(component.$$);
} }
dirty_components.length = 0;
while (binding_callbacks.length) binding_callbacks.pop()(); while (binding_callbacks.length) binding_callbacks.pop()();
// then, once components are updated, call // then, once components are updated, call
@ -67,6 +72,7 @@ export function flush() {
} }
update_scheduled = false; update_scheduled = false;
flushing = false;
seen_callbacks.clear(); seen_callbacks.clear();
} }

Loading…
Cancel
Save