Skip to content

Conversation

@Rheeseyb
Copy link
Contributor

Fixes #1414

Problem:
React stringifies the children of <option> elements by design (see facebook/react#13465). Since we were wrapping jsx text blocks in a fragment when rendering on the canvas, that meant all options would be displayed as [object Object]. I don't believe we had an explicit reason for doing this, other than the return type of the rendering function was React.ReactElement.

Fix:
Change the return type of those rendering functions to React.ReactChild, which is a union of ReactElement, string and number, so that for jsx text blocks we can just return the text as intended.

@github-actions
Copy link
Contributor

Link to test editor
Scroll Canvas: 35.9ms (25.9-56.4ms) | Resize: 69.2ms (17.4-134.1ms) | Selection: 262.5ms (205.5-740.2ms) | Calc Pi: 35ms (33-44ms) | Empty Dispatch: 42.1ms (37.6-150.4ms) | (Chart)

@Rheeseyb Rheeseyb merged commit 8b58853 into master Jun 23, 2021
@Rheeseyb Rheeseyb deleted the fix/no-text-funny-business branch June 23, 2021 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Running on the canvas mangles the text children of <option> elements

5 participants