Skip to content

Commit

Permalink
Merge branch 'master' into sveltejsgh-4372
Browse files Browse the repository at this point in the history
  • Loading branch information
Conduitry committed Feb 8, 2020
2 parents 57b9fa3 + cb67a53 commit cf34ad0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* 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))
* 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))

## 3.18.1
Expand Down
10 changes: 8 additions & 2 deletions src/runtime/internal/scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,23 @@ export function add_flush_callback(fn) {
flush_callbacks.push(fn);
}

let flushing = false;
const seen_callbacks = new Set();
export function flush() {
if (flushing) return;
flushing = true;

do {
// first, call beforeUpdate functions
// and update components
while (dirty_components.length) {
const component = dirty_components.shift();
for (let i = 0; i < dirty_components.length; i += 1) {
const component = dirty_components[i];
set_current_component(component);
update(component.$$);
}

dirty_components.length = 0;

while (binding_callbacks.length) binding_callbacks.pop()();

// then, once components are updated, call
Expand All @@ -67,6 +72,7 @@ export function flush() {
}

update_scheduled = false;
flushing = false;
seen_callbacks.clear();
}

Expand Down

0 comments on commit cf34ad0

Please sign in to comment.