-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Better error message when using a non-function as an event handler #15411
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
Comments
Hello, I even think that Note that this only concerns local variables, since it is already handled correctly for props and states :
|
I found another difference for invalid handler in props/states between dev and prod.
=> I think that the error should also be raised on dev mode. |
I came across this error by a user on discord that create a help thread. Their failure was that they did let handleClick = $props();
// later <button onclick={handleClick}> instead of let { handleClick } = $props(); And I found the error message should be clearer than |
I made a PR to fix that. The error is still the same, but on dev mode it will print the event_handler_invalid warning just before. |
Describe the problem
When you accidently use a non-function as an event handler, the error message is not very helpful.
Originating from here.
REPL
Describe the proposed solution
Throw an error with a better error message if
delegated
is not a function. At least in dev mode.Importance
nice to have
The text was updated successfully, but these errors were encountered: