Brought back a guard to prevent the flush() function from being call while a previous flush is running

pull/7397/head
AaronDDM 5 years ago
parent 0eee98a50a
commit d4bf40367f
No known key found for this signature in database
GPG Key ID: 80640C347CC099B4

@ -51,7 +51,9 @@ export function add_flush_callback(fn) {
// function, guarantees this behavior. // function, guarantees this behavior.
const seen_callbacks = new Set(); const seen_callbacks = new Set();
let flushidx = 0; // Do *not* move this inside the flush() function let flushidx = 0; // Do *not* move this inside the flush() function
let flushing = false;
export function flush() { export function flush() {
if (flushing) return;
const saved_component = current_component; const saved_component = current_component;
do { do {
@ -91,6 +93,7 @@ export function flush() {
flush_callbacks.pop()(); flush_callbacks.pop()();
} }
flushing = false;
update_scheduled = false; update_scheduled = false;
seen_callbacks.clear(); seen_callbacks.clear();
set_current_component(saved_component); set_current_component(saved_component);

Loading…
Cancel
Save