|
|
|
@ -33,7 +33,7 @@ export function add_flush_callback(fn) {
|
|
|
|
|
|
|
|
|
|
|
|
let flushing = false;
|
|
|
|
let flushing = false;
|
|
|
|
const seen_callbacks = new Set();
|
|
|
|
const seen_callbacks = new Set();
|
|
|
|
let dirty_binding_component_map = new Map();
|
|
|
|
let previous_dirty_components = [];
|
|
|
|
|
|
|
|
|
|
|
|
export function flush() {
|
|
|
|
export function flush() {
|
|
|
|
if (flushing) return;
|
|
|
|
if (flushing) return;
|
|
|
|
@ -45,10 +45,10 @@ export function flush() {
|
|
|
|
for (let i = 0; i < dirty_components.length; i += 1) {
|
|
|
|
for (let i = 0; i < dirty_components.length; i += 1) {
|
|
|
|
const component = dirty_components[i];
|
|
|
|
const component = dirty_components[i];
|
|
|
|
set_current_component(component);
|
|
|
|
set_current_component(component);
|
|
|
|
const is_dirty_from_binding = dirty_binding_component_map.has(component.constructor.name);
|
|
|
|
const is_dirty_from_binding = previous_dirty_components.indexOf(component) > -1;
|
|
|
|
update(component.$$, is_dirty_from_binding);
|
|
|
|
update(component.$$, is_dirty_from_binding);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dirty_binding_component_map = new Map();
|
|
|
|
previous_dirty_components = [];
|
|
|
|
set_current_component(null);
|
|
|
|
set_current_component(null);
|
|
|
|
|
|
|
|
|
|
|
|
dirty_components.length = 0;
|
|
|
|
dirty_components.length = 0;
|
|
|
|
@ -56,8 +56,7 @@ export function flush() {
|
|
|
|
while (binding_callbacks.length) {
|
|
|
|
while (binding_callbacks.length) {
|
|
|
|
binding_callbacks.pop()();
|
|
|
|
binding_callbacks.pop()();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dirty_components.forEach((i) =>
|
|
|
|
previous_dirty_components = [...dirty_components]
|
|
|
|
dirty_binding_component_map.set(i.constructor.name, i));
|
|
|
|
|
|
|
|
// then, once components are updated, call
|
|
|
|
// then, once components are updated, call
|
|
|
|
// afterUpdate functions. This may cause
|
|
|
|
// afterUpdate functions. This may cause
|
|
|
|
// subsequent updates...
|
|
|
|
// subsequent updates...
|
|
|
|
|