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

Inferno Error: Only one child is allowed within the Provider component #919

Closed
Aleksion opened this issue Mar 10, 2017 · 9 comments
Closed

Comments

@Aleksion
Copy link

Aleksion commented Mar 10, 2017

Before submitting an issue please:

  • Check that you are using the latest version of Inferno. Either using our CDN @ Master or by checking the tags on NPM.
  • Check that the bug has not been fixed in the latest development version. Use our CDN @ Edge.
  • Check that the issue has not been brought up before on Github issues.

If you can, please distill your problem down and include a JSFiddle example for illustration. Also when requesting bug fix please include at least one test to avoid regression.

Issue Template

Observed Behaviour

Inferno is throwing the error:
Inferno Error: Only one child is allowed within the Provider component when trying to render a Provider with only ONE child. This is currently being thrown on the server (I have yet to get the client to work with this.

I also tried adding a simple div instead of my CreateEntry component to no avail.

to be NOTED this is in: 1.2.1
I haven't upgrade yet, since the typescript isomorphic import issue is still open in 1.3.1

<Provider store={store}> <CreateEntry /> </Provider>

Expected Current Behaviour
That render renders the component without throwing an error
Inferno should...

Inferno Metadata
Version 1.2.1
macOS
NodeJS

@Aleksion
Copy link
Author

Aleksion commented Mar 10, 2017

Found the error. Apparently Spaces is considered children when rendering (at least it is on node). Resulting in two additional children in the above case.

Feel free to close this unless you want to look further into it

@longlho
Copy link
Member

longlho commented Mar 10, 2017

@Aleksion yup, spaces in the same line are considered children, but not

<Provider store={store}>
  <CreateEntry />
</Provider>

@Aleksion
Copy link
Author

Arh got it. Thanks.

But couldn\t they, theoretically, be soreted out?

This is how it looks:

[ { children: ' ',
    dom: null,
    events: null,
    flags: 1,
    key: '.0',
    props: null,
    ref: null,
    type: null },
  { children: null,
    dom: null,
    events: null,
    flags: 4,
    key: '.1',
    props: {},
    ref: null,
    type: [Function: CreateEntry] },
  { children: ' ',
    dom: null,
    events: null,
    flags: 1,
    key: '.2',
    props: null,
    ref: null,
    type: null } ]

Anyways. Thank you for a swift response!!!

@longlho
Copy link
Member

longlho commented Mar 10, 2017

the thing is spaces are considered intentional in text, like <p><span>hello</span> <span>world</span></p>

@Aleksion
Copy link
Author

Ok, got it.
Thank you for clarifying :)

@Havunen
Copy link
Member

Havunen commented Mar 11, 2017

@Aleksion do you have ticket for this:

I haven't upgrade yet, since the typescript isomorphic import issue is still open in 1.3.1?

@Aleksion
Copy link
Author

@Havunen - yeah I believe it's tracked on #686
I can open a new one if you prefer that though :)

@longlho
Copy link
Member

longlho commented Mar 12, 2017

@Aleksion #931 might address your TS issue

@LukeSheard
Copy link
Contributor

Since this seems to be fixed. I'm going to close this issue. Feel free to reopen if there's something I've missed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants