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

fix(canvas) Leave jsx text blocks as they are when rendering the canvas #1420

Merged
merged 1 commit into from
Jun 23, 2021

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
4 participants