dillon1000/react

Commit

Fix "null" instead of the component stack in a warning (#10915)

* Add a failing test that prints "null" in the warning instead of the stack

* Don't reset the current fiber during reconciliation

It should only be reset when we stop doing work.
Otherwise, any warnings after the reset will lose the component stack.

The reset in getMaskedContext() was completely unnecessary.
It is always called with the same fiber as the current work in progress.
Therefore, I add a DEV-only warning assertion to ensure we don't regress, and remove the reset.

The reset in processChildContext() is necessary because it can be called outside of reconciliation.
Unfortunately, we have to keep this hack in until we can remove unstable_renderSubtreeIntoContainer().
To work around it, I restore the previous fiber instead of resetting.

* Decouple setting the current fiber and phase

These are two distinct actions.
This helps make it clearer when we're actually changing the current pointer.

I'm also removing an overengineered hack I previously added for unstable_renderSubtreeIntoContainer. It's not necessary now that we don't null the pointer all the time.
This makes the code more straightforward.

* Centralize the pointer updates in the scheduler
Browse files
Changed paths7 files
First-parent comparison
M src/renderers/__tests__/ReactStatelessComponent-test.js ModifiedM src/renderers/shared/fiber/ReactDebugCurrentFiber.js ModifiedM src/renderers/shared/fiber/ReactFiberBeginWork.js ModifiedM src/renderers/shared/fiber/ReactFiberCompleteWork.js ModifiedM src/renderers/shared/fiber/ReactFiberContext.js ModifiedM src/renderers/shared/fiber/ReactFiberReconciler.js ModifiedM src/renderers/shared/fiber/ReactFiberScheduler.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…