Skip to content

Commit ae9f53a

Browse files
fix: account for mutations in script module in ownership check (#14253)
1 parent 7bc94b9 commit ae9f53a

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

.changeset/good-laws-sin.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: account for mutations in script module in ownership check

packages/svelte/src/internal/client/dev/ownership.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ export function get_component() {
5959
}
6060

6161
for (const module of modules) {
62+
if (module.end == null) {
63+
return null;
64+
}
6265
if (module.start.line < entry.line && module.end.line > entry.line) {
6366
return module.component;
6467
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { test } from '../../test';
2+
3+
export default test({
4+
compileOptions: {
5+
dev: true
6+
}
7+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<script module>
2+
let obj = $state({});
3+
obj.test = "hi!";
4+
</script>
5+
6+
<h1>Values: {JSON.stringify(obj)}</h1>

0 commit comments

Comments
 (0)