-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Svelte 5: <svelte:component bind:this={ref} /> ref is undefined #10309
Comments
|
Shouldn't it still give you the component instance? It looks like if you export something you get a |
Component API is changed in Svelte 5. You can read a bit in #9827. Also, there is no It's arguable whether an instance of a component without accessors should be |
The component now always returns at least |
Describe the bug
In Svelte 5 <svelte:component this={component} bind:this={component_ref} /> will return "undefined" for component_ref.
This is annoying in cases where you want to e.g. dynamically trigger events like component_ref.click() from outside.
A workaround is to use classic document.querySelector.
Reproduction
REPL:
https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAE42SvU7DMBSFX-XKQmorVQ0Dk5tYAl4AiZEglMY3xWpiW7YDtFFWNiQWBqZOvBhP0EdAzg8pPypsuUffOTm2b0UykaMl9KoiMimQUHKqNZkSt9Z-sHeYOyRTYlVpUq-ENjVCOxbL2IlCK-PgQq3wTN3nkBlVwGgW9MKstY_m-7DYbJKB9NMXLEcHqSq0kigdRHBkXeJw3EdOfkI3BrMB9EAYDCVluCidUxKUTHORrqJqPIlYtf-LpkRdM4tdvTBoPexf7q5ZH9CNexmxDNsT0sHnboWNhpwaFkJy-k31J6shaCM0u8QcU4ccznuAQmh1Itk3Sxg0KozfH5-hlBwzIZFPWBjoro5b59g8oQeh8l-xWyTpamlUKTkFg3zeqjrhXMglhWM40Q-NWDdX3GSQKSkUF5lATqgzJdbTz03qr-LgOmnmMfDcbvv26isezPTv81dgs2K77dPL72nX9QfkPCtV9wIAAA==
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: