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

Nested Fragments fail #53

Closed
caedmon opened this issue Aug 28, 2019 · 2 comments · Fixed by #54
Closed

Nested Fragments fail #53

caedmon opened this issue Aug 28, 2019 · 2 comments · Fixed by #54
Assignees
Labels
bug Something isn't working

Comments

@caedmon
Copy link

caedmon commented Aug 28, 2019

Attempting to nest Fragments with multiple children leads to exception:

TypeError: Cannot read property 'children' of undefined
     at JSXSlack (.../node_modules/@speee-js/jsx-slack/lib/jsx.js:23:60)
     at children.reduce (.../node_modules/@speee-js/jsx-slack/lib/jsx.js:27:69)
     at Array.reduce (<anonymous>)
     at toArray (.../node_modules/@speee-js/jsx-slack/lib/jsx.js:25:53)
     at Object.JSXSlack (.../node_modules/@speee-js/jsx-slack/lib/jsx.js:37:20)
     at ...

To reproduce:

JSXSlack(
  <Blocks>
    <Fragment>
      <Fragment>
        <Section>A</Section>
        <Section>B</Section>
      </Fragment>
      <Fragment>
        <Section>C</Section>
        <Section>D</Section>
      </Fragment>
    </Fragment>
    <Fragment>
      <Fragment>
        <Section>A</Section>
        <Section>B</Section>
      </Fragment>
      <Fragment>
        <Section>C</Section>
        <Section>D</Section>
      </Fragment>
    </Fragment>
  </Blocks>
)
@yhatt
Copy link
Owner

yhatt commented Aug 28, 2019

Thanks for your reporting. It seems to be an edge case in specific structure with fragments. I'll try to fix it.

@yhatt yhatt self-assigned this Aug 28, 2019
@yhatt yhatt added the bug Something isn't working label Aug 28, 2019
yhatt pushed a commit that referenced this issue Aug 29, 2019
JSXSlack could not parse nested fragments because lodash.flatten can
only flatten a single level. I swapped module from lodash.flatten to
lodash.flattendeep for flattening nested array.

Resolves #53.
@yhatt yhatt closed this as completed in #54 Aug 29, 2019
@yhatt
Copy link
Owner

yhatt commented Aug 29, 2019

Fixed in v0.9.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants