Skip to content
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

TypeError: can't access property "checkValidity", this.input is undefined #313

Closed
explorigin opened this issue Jan 25, 2021 · 1 comment
Closed
Assignees
Labels
bug Things that aren't working right in the library.

Comments

@explorigin
Copy link

Describe the bug
TypeError: can't access property "checkValidity", this.input is undefined
It is possible to reference this.input in <sl-input> before the internal render() function is called (and hence assigns this.input).

To Reproduce
When using <sl-input> underneath a custom Hybrids component, I was able to trigger the reference error. I have not been able to reproduce it with codepen.

Expected behavior
handlers should queue handling (or at least fail gracefully) if internal references are not populated.

Screenshots
image
image

Desktop (please complete the following information):
OS X Firefox 85

Additional context
I'm able to reproduce this in my own (rather complex) build setup with webpack. Regardless of reproducibility. It's clear to see that there is a race condition in the code where several handlers assume that this.input is populated where there are scenarios where the handlers can be called before render() is called.

@explorigin explorigin added the bug Things that aren't working right in the library. label Jan 25, 2021
@claviska
Copy link
Member

I thought about this and adding a guard is the simplest fix. I'm OK with the assumption that if the value somehow changes between when the component is connected and first render, then the value at first render will be the initial value. Fixed in both input and textarea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Things that aren't working right in the library.
Projects
None yet
Development

No branches or pull requests

2 participants