Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG Svelte 5: bind:this sets to null if a store is used in #each #15698

Open
python273 opened this issue Apr 6, 2025 · 0 comments
Open

BUG Svelte 5: bind:this sets to null if a store is used in #each #15698

python273 opened this issue Apr 6, 2025 · 0 comments

Comments

@python273
Copy link

python273 commented Apr 6, 2025

Describe the bug

{#each $windowsStore as w (w.id)}
<w.component bind:this={instances[w.id]} />
{/each}

Reproduction

With store, nulls in instances after adding a few windows:

https://svelte.dev/playground/hello-world?version=5.25.7#H4sIAAAAAAAAE3VTwa6bMBD8lX00UkCN4I4SpKf20FsPPfSQ5GDw0lh1bGQvoZXFv3cdCI9U7928uzPj2cGExIgrJmXyDbW2MFinJaQoFaHMkl3SKo0-KY8hob9dxMUG92fWa9fl_oaaYq8WHt_rN9YQGmKZZO8bpzqqTkZdO-sIAgxOkag1wgits1fYTrzCk3W4PZmTYb6PSN_XkV7jDvpOCoqUw8JPj-fsDT0oI-3gf0QRBoWTgRU_VpPE_SikLCENjWVPhp2OGRyqifPApbPgagCPS_Ku95c0KBbZbj8bHOBrZGT5Tegev7dptoOV9oPtkHpnHiJTd5qO7GqMu8whfXmQ54TyYunMKXNOGgkUry5Mg2wTNnxkFyFKbnjQYUPpArhH1famIWUNWPMq5c-7kTSL-51oHWDOAa3iKd8MRXF2ui-W78pF3RPdRRutmt-HsFIfKz7OK--LCXgnhU8omgtsnr6b8DBAOuRKZvGSIV8sQM24ki7KH8Ky0zEizyMUrBiKqDfy6yP8Q0lJrsdx98Er_j_N57f8znT9oqW6VXtPzppf1SX-RC8vHMdU74s4fTZx5kooHRdNylZoj-M_WJmeroUDAAA=

Using $state, no nulls in instances:

https://svelte.dev/playground/hello-world?version=5.25.7#H4sIAAAAAAAAE3VSwW7CMAz9FZMh0WqovVelEtoOu-2www6UQ0ncNVpIqsalm6L--xJgBSZ2Svye_ewXxzFd7ZFl7AWVMjCYTgmIUEhCEbMlq6VCy7KNY_TdhrwAePxctW7bxB5QUcB2lcV7ODeaUJOXYbnlnWypKLXct6YjeDL-1J6FujN7WCTphJwFFqVWSCC1pUpztLCCub8SRm6MT9wgtTCDfSPT4YXebD0993Utcoqmeg-Wuu41J2k0GL0W4v1YH8XgPEfXaknb2yZyUmSwWDxqHOA5SMfJoVI9vtZRvAT-O3B2cRMmG0udp5NfH-x6omNLriT_XLmr3mPhr2cfeXpKPBa5B6x4c-uwsjBANCRSxKHHkEwTwM7nZdRIu3KT4U3I3I6QekGXBrnRL4Xwi1hGXY_j8p_l_t3E7YrvsNeLFvJQ5JY6oz-KJvyt2cy_xinO08DeDrH1USVVMMqyulIWxx9JQ9q5nAIAAA==

Using store and bind:this={() => instances[w.id], (v) => instances[w.id] = v}, no nulls:

https://svelte.dev/playground/hello-world?version=5.25.7#H4sIAAAAAAAAE3VTwY6bMBD9lVkaKUaN4I6SSKvdQ2899NBDkoPBk8aqYyM8hFYW_94xEJZU2Zs9897zm2c7JFZeMSmSb2iMg841RoFApQlVmmySszbok-IQEvpbR1wscH1ivdZ15m9oKNZK6fFZvXKW0BLLJFtfNbqm_dHqa-0aggBdo0mWBqGHc-OusB55uSfX4Ppoj5b5PiJ9W0Z6iRtoayUpUnYzXxxO6Qe601a5zv-IIgwKRwsLftyNEsNSKlWACJVjT5ad9ins9iPnjhOT4KIB90OyuvUXETSLrNdfLXbwHhlpdpOmxe9nkW5goX1nN0htY-8iY3Xs9uyqj7NMIb3dyVNCWT5XppQ5J4MEmkeXtkK2CStesosQJVfcqLEiMQOGqM6trUg7C86-KvVzMCLSON-RlgFmHNAinuLDUBRnp9t8vlfelC3RIFoZXf3ehYV6v-flNPI2H4EDKXxBWV1g9XBv0kMHosu0SuMhXTZbgJJxBV203wUx3NY82SHiTxsQt2d1DubWQ85nhjye2PP7JPxDSUFNi_3mk3f-f96Pr_1Jd_nmlb7tt54aZ3_tL_GbvbxwYON-m8fuo4kT76Q2MYqkOEvjsf8Hy6qhmacDAAA=

Logs

System Info

-

Severity

blocking an upgrade

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant