-
-
Notifications
You must be signed in to change notification settings - Fork 8.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
event modifier breaks if handler is undefined #9865
Comments
FYI you should just do |
Totally - My issue came from the undefined template ref case. The reproduction given was just easier to show by setting directly to undefined - which obviously makes no sense :) Thanks so much for the quick fix @yyx990803 |
Quick question - I just updated my vue version and I'm still seeing the issue (even though I can see it resolved in the playground). Is that because the code is compiler related and I need to wait for @vitejs/plugin-vue to update to the latest version? Thanks so much! |
Vue version
3.3.12
Link to minimal reproduction
https://play.vuejs.org/#eNqNUk1PGzEQ/SvGl7QSuxblFi1RWoTU9tBWBYmLL2F3khj8JXu8RFrtf2fsFSGJEOJmz3sz897MDPy793WfgM95E9ugPLIImPxCWmW8C8gGFmDNRrYOzrAZUWfSSts6G5GZuGFXGf8y+wlaO3bvgu7OZl8zpRFTQSpFHwTj9QqBfow124vFMJT0cWwE/UpUWZ+Q9ZVxHegryQmXnIkJfEiIzrJlq1X7VPsAPVgkUrIdrJWFTvLFdcaYgbNGTHRKbcRBa37OMZL2tdrUj9FZsj3k6pK3znilIfz1qMib5HNWkIytyNrz7xLDkOD8Nd5uoX16J/4Ydzkm+b8AEUIPku8xXIUN4ATf3P6BHb33IBlPmtgfgP8hOp2yxon2g/yT7ANeUfurLE/ZzV282SHY+GoqC83MsfAlp4Vef2D9Te5lfVnypB1pitNxVGblT+Y4AcdFqMckdovo41yItrOURktWfagtoLDeiCXRREgWlYGqc2ZJHeuLb6JTEQ/jNURTPQT3TKOlO3AdlTqwn6uUoYcqAN1GyMP5XPOTtCMBJ9iRiNx/P5vxBXr5H20=
Steps to reproduce
Use an event modifier (like .prevent on a click event that has an undefined handler - for example
@click.prevent="undefined"
While that may seem silly, something like
@click.prevent="myModalRef?.open()"
is totally reasonable and can result in the same thing...What is expected?
no crash. Probably @click.prevent should still prevent default behaviour...
What is actually happening?
page crashes, with error Cannot read properties of undefined (reading '_withMods')
System Info
No response
Any additional comments?
PS - the new issue wizard thing broke.. I got the "Issue Preview" screen, but then it just kept kicking me back to the native "new issue" button on github.
The text was updated successfully, but these errors were encountered: