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 JSXSlack.Children.toArray to make flatten children correctly even if caused dual import of <Fragment> #320

Merged
merged 3 commits into from
Oct 31, 2024

Conversation

yhatt
Copy link
Owner

@yhatt yhatt commented Oct 31, 2024

#319 reports <Fragment> can include in <Section> but <> cannot. Why?

JSXSlack.Children.toArray makes flatten children in <Fragment> component, but jsx-slack will check the equality of Fragment function by using only a function in JSXSlack namespace, in spite of Fragment in JSX runtime (<>) and in JSXSlack namespace (<JSXSlack.Fragment>) may point each different functions.

So the children of <Section> cannot make flatten <></> correctly, and remains <> in the normalized children, that is not supposed to exist, and <Section> component denies that as children.

This PR changes the <Fragment> detection to use the name of built-in component instead of the function itself.

…omponent to make flatten children by using `JSXSlack.Children.toArray`
@yhatt yhatt linked an issue Oct 31, 2024 that may be closed by this pull request
@yhatt yhatt merged commit 2d9451c into main Oct 31, 2024
7 checks passed
@yhatt yhatt deleted the fix-dual-fragment-hazard branch October 31, 2024 15:23
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.

Cannot use Fragment inside a Section
1 participant