Skip to content

'Undefined Reference' when indexing a $bindable prop in dev mode #15840

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
jhwz opened this issue Apr 27, 2025 · 2 comments · Fixed by #15848
Closed

'Undefined Reference' when indexing a $bindable prop in dev mode #15840

jhwz opened this issue Apr 27, 2025 · 2 comments · Fixed by #15848
Assignees

Comments

@jhwz
Copy link
Contributor

jhwz commented Apr 27, 2025

Describe the bug

The generated code in dev mode references an undefined variable, maybe it thinks every variable in the expression has been declared with $.prop?

Reproduction

https://svelte.dev/playground/8e7f81107bbd4530a08a77ebe520a10b?version=5.28.2

Look at the JS output, compiler options must be:

  • generate: client
  • dev: true

Logs

System Info

NA

Severity

annoyance

@tanishq-aggarwal
Copy link

I discovered a bug that seems similar to this one.

Description

When destructuring a prop via $props() without supplying a default value, event handlers that reference that prop throw a ReferenceError at runtime—even though the console log immediately before shows the correct value. This behavior is non-intuitive and prevents the normal use of destructured props in runes mode.

Reproduction

https://svelte.dev/playground/70034561066340c98c157d86ec3c2df2?version=5.28.2
Child2 works as expected, but Child1 throws ReferenceError though it shouldn't.

@paoloricciuti
Copy link
Member

Yup both of this should be fixed by my pr.

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.

3 participants