Lint and format src/compiler/compile/render_dom/wrappers/shared/Tag.js

pull/8569/head
Simon Holthausen 3 years ago
parent cc2372b5e1
commit a6fb5c13f5

@ -3,7 +3,6 @@ import Wrapper from './Wrapper.js';
/** @extends Wrapper */
export default class Tag extends Wrapper {
/** @type {import('../../../nodes/MustacheTag.js').default | import('../../../nodes/RawMustacheTag.js').default} */
node;
@ -28,8 +27,7 @@ export default class Tag extends Wrapper {
const value = this.node.should_cache && block.get_unique_name(`${this.var.name}_value`);
const content = this.node.should_cache ? value : snippet;
snippet = x`${snippet} + ""`;
if (this.node.should_cache)
block.add_variable(value, snippet); // TODO may need to coerce snippet to string
if (this.node.should_cache) block.add_variable(value, snippet); // TODO may need to coerce snippet to string
if (dependencies.length > 0) {
let condition = block.renderer.dirty(dependencies);
if (block.has_outros) {
@ -39,12 +37,10 @@ export default class Tag extends Wrapper {
if (this.node.should_cache) {
condition = x`${condition} && ${update_cached_value}`;
}
block.chunks.update.push(b `if (${condition}) ${update(/** @type {import('estree').Node} */ (content))}`);
block.chunks.update.push(
b`if (${condition}) ${update(/** @type {import('estree').Node} */ (content))}`
);
}
return { init: content };
}
}

Loading…
Cancel
Save