diff --git a/.changeset/lucky-schools-hang.md b/.changeset/lucky-schools-hang.md new file mode 100644 index 0000000000..e83a19f3a0 --- /dev/null +++ b/.changeset/lucky-schools-hang.md @@ -0,0 +1,5 @@ +--- +'svelte': patch +--- + +fix: ensure dynamic attributes containing call expressions update diff --git a/packages/svelte/src/compiler/phases/2-analyze/index.js b/packages/svelte/src/compiler/phases/2-analyze/index.js index c1511e3355..99baf37307 100644 --- a/packages/svelte/src/compiler/phases/2-analyze/index.js +++ b/packages/svelte/src/compiler/phases/2-analyze/index.js @@ -762,7 +762,7 @@ const common_visitors = { return false; } - return chunk.metadata.dynamic; + return chunk.metadata.dynamic || chunk.metadata.contains_call_expression; }); if (is_event_attribute(node)) { diff --git a/packages/svelte/tests/runtime-runes/samples/dynamic-style-attr/_config.js b/packages/svelte/tests/runtime-runes/samples/dynamic-style-attr/_config.js new file mode 100644 index 0000000000..f682972179 --- /dev/null +++ b/packages/svelte/tests/runtime-runes/samples/dynamic-style-attr/_config.js @@ -0,0 +1,17 @@ +import { test } from '../../test'; +import { flushSync } from 'svelte'; + +export default test({ + html: `