Skip to content

handle null method when using autofocus on field#8

Merged
erikras merged 1 commit intofinal-form:masterfrom
voxtex:autofocus-fix
Dec 24, 2018
Merged

handle null method when using autofocus on field#8
erikras merged 1 commit intofinal-form:masterfrom
voxtex:autofocus-fix

Conversation

@voxtex
Copy link
Contributor

@voxtex voxtex commented Dec 14, 2018

When an input has autofocus={true} attribute, state.focus is not initialized the first time the method is invoked. Couldn't find a way to force this to initialize prior to being invoked by autofocus, at the very least this will stop an exception that prevents react from rendering.

@voxtex
Copy link
Contributor Author

voxtex commented Dec 14, 2018

As I was playing around with this I found a better fix. Instead of working around the problem, correctly record the scenario where field state is unavailable to call focus in a ref and then invoke it the next time the subscriber gets invoked.

@erikras
Copy link
Member

erikras commented Dec 24, 2018

Interesting. Seems legit. 👍

@erikras erikras merged commit 97b14c4 into final-form:master Dec 24, 2018
@lock
Copy link

lock bot commented Jan 23, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 23, 2019
@erikras
Copy link
Member

erikras commented Jan 23, 2019

Published in v1.0.0-alpha.2.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants