Keep track of flushing state

pull/4356/head
Jordan Gensler 6 years ago
parent 45053c26e3
commit 508d523022

@ -31,8 +31,11 @@ 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
@ -69,6 +72,7 @@ export function flush() {
} }
update_scheduled = false; update_scheduled = false;
flushing = false;
seen_callbacks.clear(); seen_callbacks.clear();
} }

Loading…
Cancel
Save