[form-builder] Wrap BlockEditor in forwardRef #1464
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The change in #1450 wrapped the Block/Portable Text editor in a function component. Since function components can't be given refs, this caused the form builder to fail when trying to set focus on the portable text input component (see #1456).
I'm afraid we're going to see a lot more of these errors going forward, since the whole React community is shifting towards function components. So we should probably reconsider how we do the focus management in the form-builder (and align with the recent work/proposal to add declarative focus management to React).
I'll see if I can whip up a separate PR improving the error message to hint about this particular case, but this should at least fix the issue at hand.