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

Introduce an internal version of replaceChildren #4

Merged
merged 1 commit into from
Nov 25, 2022

Conversation

skirtles-code
Copy link
Owner

replaceChildren() is used by addProps() and betweenChildren() internally. This PR introduces replaceChildrenInternal() that all 3 can use instead.

replaceChildrenInternal() doesn't have the dev warnings for the arguments. This avoids duplicate warnings when addProps() or betweenChildren() call it, or when it calls itself recursively. This does potentially remove an argument check on the children for recursive calls, but that really isn't an edge case those checks were intended to catch. The warnings in that unlikely scenario would have been confusing anyway.

replaceChildrenInternal() also doesn't specify a default for the options argument. This potentially allows SKIP_COMMENTS to be tree-shaken if replaceChildren() isn't used directly.

@skirtles-code skirtles-code merged commit a5e31fb into main Nov 25, 2022
@skirtles-code skirtles-code deleted the replace-children-refactor branch May 6, 2023 03:20
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.

1 participant