Skip to content

Child $effect does not run initially for function called from template expression #13682

@bdpartridge

Description

@bdpartridge

Describe the bug

When a child $effect is triggered by a function call inside a template expression, it does not run after the component is mounted. See the linked reproduction for a simple example. Notice how the same effect works as expected when a {@const ...} tag is used instead of calling the function inline. The effect also starts to work as expected after the template is conditionally re-rendered; try toggling the checkbox. Is this difference in behavior expected?

Reproduction

https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAE3VSQW7jMAz8CsvNwQES--44we4bdrGXqkAdmWrUKpIg0UkKw38vJLtJgLYnidQMZ0hxQKUNRawfB7TtkbDGP97jCvndpyCeyDDhCqPrg0yZJsqgPe-EFayP3gWG4YX4f2t6GkEFdwSBZXVKcTnRy9cocCNsohhiiAd3znjYwiJyy1Rw6Gm5EbapbuVt0-lT1mlMuyeTr4IbbX3PkAxuBcoDybe9uwiEvbZdnWPqtsNVZIRqZv49uDPkXC5afVZtqlnINg_rNZxdeIvQRqCLJ8nUwXq9E3b4pdXN-phKDL-ls5HhNDfzOYdCoHJO4DKjGj_r_zvQDNURhnwby8lKggyVVuPVBSlFkqFzFME6htBb0Fazbo15_9HRD1p3xvZtSMa-6uIKj67TSlOHdfqPcXXdifvfvC3Ha7xfDLrkZVC9laydvQ0jk5cwJMXF1FZRLGG7m1KC0xCdodK4l-J5AtSwmAf0nNYioQJxHyxMzG8oIA21tvdfqON0zPz8tBH2246fxg8E_hdTEQMAAA==

Logs

No response

System Info

Svelte 5.0.0-next.269

Severity

annoyance

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions