Skip to content

can't yield children from a generator in render() #12995

@threepointone

Description

@threepointone

Do you want to request a feature or report a bug?

bug.

What is the current behavior?

via this thread https://twitter.com/aweary/status/1004837394439290880
passing the result of a generator as a child doesn't 'work'. it renders no children, without an error or warning.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:

repro - https://codesandbox.io/s/5zp0j8389x

What is the expected behavior?

for the above example, a hundred <span>s, numbered 100 -> 1

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

16.x, all browsers

(It appears the validation logic drains the iterator, so when we finally try to 'get' the children again, it returns nothing.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions