sveltejs / svelte

Cybernetically enhanced web apps
https://svelte.dev
MIT License
76.8k stars 3.98k forks source link

Svelte 5: faulty ownership_invalid_binding errors are back, inside #if blocks #11483

Closed markjaquith closed 1 week ago

markjaquith commented 1 week ago

Describe the bug

11399 tracked faulty ownership_invalid_binding errors.

This was fixed for 5.0.0.next.121 in #11401.

Something in 5.0.0.next.123 broke it again, specifically inside #if blocks. (Probably 6e5ab2e67874fd04038ea2686617312bcbd68fc8 ?)

The only thing I changed from @Rich-Harris's reproduction from #11399 was wrapping a dummy #if around the children:

<Outer>
  {#if true}
    <Inner bind:object />
  {/if}
</Outer>

"%c[svelte] ownership_invalid_binding\n%cOuter.svelte passed a value to Inner.svelte with bind:, but the value is owned by App.svelte. Consider creating a binding between App.svelte and Outer.svelte"

Reproduction

https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAE41RQU6EQBD8Sqc1WYgE9IqAetyTDxAPy9DoKPSQoTExhL-bmdHd1ZjNHuZQk6ruquoFO93ThPnTgrwbCHN8GEdMUD5HB6YP6oUwwcnMVrmfYlJWj1LVXIseRmMFHmchC501A2zSzKM0CDe3R7Qt8xHNo18093oSMM0bKYESLifZCUULKDOz5HANa3xbc5EdLHDh13k3y4XuQOxMq58mRVjYaG7z75lZIGa6W92coMUEB9PqTlOLudcn-zI844w6oN_xS1mjTDVWP0EWUK-6by0xrC7OaM04RfGfBMu9JW7J7sl3aRSvp0z5XOfeKBg5dOrq2DU9RfFJU0GQ-uZdV80sYhjcyrLGgGoEw6rX6r1cohjKCo5VVyXcrNWWlaWBWIosiP6p-3n9Av_binmHAgAA

Logs

No response

System Info

System:
    OS: macOS 14.4
    CPU: (10) arm64 Apple M1 Max
    Memory: 6.04 GB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 10.5.0 - ~/Library/Application Support/Herd/config/nvm/versions/node/v18.20.2/bin/npm
    pnpm: 7.21.0 - /opt/homebrew/bin/pnpm
    bun: 1.1.7 - /usr/local/bin/bun
  npmPackages:
    svelte: 5.0.0-next.123 => 5.0.0-next.123

Severity

annoyance