lazily merge deps

pull/7610/head
Nayan Gautam 4 years ago committed by gtmnayan
parent e89be644f8
commit 69e1f839cc

@ -1145,25 +1145,27 @@ export default class ElementWrapper extends Wrapper {
block.chunks.hydrate.push(updater); block.chunks.hydrate.push(updater);
const dependencies = [
...this.dynamic_style_dependencies,
...expression.dynamic_dependencies()
];
// Assume that style has changed through the spread attribute // Assume that style has changed through the spread attribute
if (has_spread) { if (has_spread) {
block.chunks.update.push(updater); block.chunks.update.push(updater);
} else if (dependencies.length > 0) { } else {
const is_dirty = block.renderer.dirty(dependencies); const dependencies = [
const condition = should_cache ...this.dynamic_style_dependencies,
? x`${is_dirty} && (${cached_snippet} !== (${cached_snippet} = ${snippet}))` ...expression.dynamic_dependencies()
: is_dirty; ];
block.chunks.update.push(b` if (dependencies.length > 0) {
if (${condition}) { const is_dirty = block.renderer.dirty(dependencies);
${updater} const condition = should_cache
} ? x`${is_dirty} && (${cached_snippet} !== (${cached_snippet} = ${snippet}))`
`); : is_dirty;
block.chunks.update.push(b`
if (${condition}) {
${updater}
}
`);
}
} }
}); });
} }

Loading…
Cancel
Save