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

Element: Fix Fragment render error on empty children #6711

Merged
merged 1 commit into from
May 14, 2018

Conversation

aduth
Copy link
Member

@aduth aduth commented May 11, 2018

Extracted from #6467

This pull request seeks to resolve an error which will be thrown by wp.element.renderToString when attempting to serialize a wp.element.Fragment with children absent.

Testing instructions:

Verify unit tests pass:

npm run test-unit

@aduth aduth added the Framework Issues related to broader framework topics, especially as it relates to javascript label May 11, 2018
Copy link
Member

@jorgefilipecosta jorgefilipecosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR looks good to me 👍
For testing purposes, I changed the paragraph save return to:

		return (
			<Fragment>
				<RichText.Content
					tagName="p"
					style={ styles }
					className={ className ? className : undefined }
					value={ content }
				/>
				<Fragment>
				</Fragment>
				<Fragment>
					Ok
				</Fragment>
			</Fragment>
		);

In this branch, the output is the expected in master it isn't.

@aduth aduth merged commit 73f2331 into master May 14, 2018
@aduth aduth deleted the fix/element-fragment-empty-children branch May 14, 2018 16:12
@aduth aduth added this to the 2.9 milestone May 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Framework Issues related to broader framework topics, especially as it relates to javascript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants