Content-Length: 224765 | pFad | http://github.com/sveltejs/svelte/issues/16018

C4 falsy attachments don't work when passed as a prop · Issue #16018 · sveltejs/svelte · GitHub
Skip to content

falsy attachments don't work when passed as a prop #16018

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

Closed
jjones315 opened this issue May 28, 2025 · 0 comments · Fixed by #16021
Closed

falsy attachments don't work when passed as a prop #16018

jjones315 opened this issue May 28, 2025 · 0 comments · Fixed by #16021

Comments

@jjones315
Copy link

Describe the bug

When trying to conditionally attach to a component when the attachment expression is false a run time error occurs.
for example

<Child1 {@attach enabled && attachment}>
</Child1>

will result in the error
TypeError: (get(...) && attachment) is not a function

while passing enabled down and putting the attachment expression in the Child component works as expected.

Reproduction

https://svelte.dev/playground/08d0da19e5204af9ba1d3103af029d69?version=5.33.4

click the "Enabled" checkbox to disable the attachment. notice the error. comment out <Child1... and <Child2... works as expected

Logs

Uncaught TypeError: (get(...) && attachment) is not a function

	in Child1.svelte
	in App.svelte

    at [@attach] (playground:output:3957:69)
    at eval (playground:output:3184:63)
    at update_reaction (playground:output:1949:57)
    at update_effect (playground:output:2115:19)
    at flush_queued_effects (playground:output:2230:7)
    at flush_queued_root_effects (playground:output:2201:6)

System Info

running in repl@5.33.4. don't have access to my machine atm

Severity

annoyance

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

Successfully merging a pull request may close this issue.

1 participant








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/sveltejs/svelte/issues/16018

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy