dillon1000/react

Commit

Simplify coroutines by making yields stateless

Coroutines was kind of broken because it tried to do reparenting and
enabling state preservation to be passed along the coroutine. However,
since we couldn't determine which Fiber was "current" on a reified yield
this was kind of broken.

This removes the "continuation" part of yields so they're basically just
return values. It is still possible to do continuations by just passing
simple functions or classes as part of the return value but they're not
stateful.

This means that we won't have reparenting, but I actually don't think we
need it. There's another way to structure this by doing all the state in
the first phase and then yielding a stateless representation of the result.
This stateless representation of the tree can then be rendered in different
(or even multiple) locations.

Because we no longer have a stateful continuation, you may have noticed
that this really no longer represent the "coroutine" concept. I will
rename it in a follow up commit.
Browse files
Changed paths7 files
First-parent comparison
M src/isomorphic/classic/element/ReactElementValidator.js ModifiedM src/renderers/shared/fiber/ReactChildFiber.js ModifiedM src/renderers/shared/fiber/ReactFiber.js ModifiedM src/renderers/shared/fiber/ReactFiberCompleteWork.js ModifiedD src/renderers/shared/fiber/ReactReifiedYield.js DeletedM src/renderers/shared/fiber/__tests__/ReactCoroutine-test.js ModifiedM src/renderers/shared/fiber/isomorphic/ReactCoroutine.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…