Skip to content

Commit

Permalink
fix logic
Browse files Browse the repository at this point in the history
  • Loading branch information
tanhauhau committed Feb 26, 2023
1 parent 9854c1d commit 8a31f0a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/compiler/compile/render_dom/wrappers/Element/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -840,11 +840,13 @@ export default class ElementWrapper extends Wrapper {
b`${fn}(${this.var}, ${data});`
);

block.chunks.update.push(b`
${fn}(${this.var}, ${data} = @get_spread_update(${levels}, [
${updates}
]));
`);
if (this.has_dynamic_attribute) {
block.chunks.update.push(b`
${fn}(${this.var}, ${data} = @get_spread_update(${levels}, [
${updates}
]));
`);
}

// handle edge cases for elements
if (this.node.name === 'select') {
Expand Down Expand Up @@ -1108,7 +1110,7 @@ export default class ElementWrapper extends Wrapper {

block.chunks.hydrate.push(updater);

if ((this.node.is_dynamic_element && this.has_dynamic_attribute) || has_spread) {
if ((this.node.is_dynamic_element || has_spread) && this.has_dynamic_attribute) {
block.chunks.update.push(updater);
} else if ((dependencies && dependencies.size > 0) || this.class_dependencies.length) {
const all_dependencies = this.class_dependencies.concat(...dependencies);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
let primary = true;
export let primary = true;
let elem;
</script>

Expand Down

0 comments on commit 8a31f0a

Please sign in to comment.