-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Description
Describe the bug
When a component is rendered as children in another component, if it references any props at the script top-level, it will remount when that prop changes.
<!-- App.svelte -->
<script>
let count = $state(0)
setInterval(() => count++, 100)
</script>
<Parent>
<Child {count} />
<Parent />
<!-- Child.svelte -->
<script>
const { count } = $props()
console.log('mount', count)
</script>Reproduction
Check the console
Logs
No response
System Info
System:
OS: macOS 14.0
CPU: (10) arm64 Apple M1 Max
Memory: 384.41 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.10.0 - ~/Library/pnpm/node
npm: 10.1.0 - /opt/homebrew/bin/npm
pnpm: 8.8.0 - ~/Library/pnpm/pnpm
bun: 1.0.0 - ~/.bun/bin/bun
Browsers:
Chrome: 118.0.5993.70
Safari: 17.0
npmPackages:
svelte: 5.0.0-next.12 => 5.0.0-next.12Severity
annoyance
Metadata
Metadata
Assignees
Labels
No labels