diff --git a/scripts/fiber/tests-passing.txt b/scripts/fiber/tests-passing.txt
index cc1163352e..c583f26488 100644
--- a/scripts/fiber/tests-passing.txt
+++ b/scripts/fiber/tests-passing.txt
@@ -854,6 +854,7 @@ src/renderers/__tests__/ReactUpdates-test.js
* handles reentrant mounting in synchronous mode
* mounts and unmounts are sync even in a batch
* does not re-render if state update is null
+* synchronously renders hidden subtrees
src/renderers/__tests__/refs-destruction-test.js
* should remove refs when destroying the parent
diff --git a/src/renderers/__tests__/ReactUpdates-test.js b/src/renderers/__tests__/ReactUpdates-test.js
index fd5bed2632..b4957cc993 100644
--- a/src/renderers/__tests__/ReactUpdates-test.js
+++ b/src/renderers/__tests__/ReactUpdates-test.js
@@ -1160,15 +1160,16 @@ describe('ReactUpdates', () => {
expect(mounts).toBe(1);
});
- it('mounts and unmounts are sync even in a batch', done => {
+ it('mounts and unmounts are sync even in a batch', () => {
+ var ops = [];
var container = document.createElement('div');
ReactDOM.unstable_batchedUpdates(() => {
ReactDOM.render(
Hello
, container);
- expect(container.textContent).toEqual('Hello');
+ ops.push(container.textContent);
ReactDOM.unmountComponentAtNode(container);
- expect(container.textContent).toEqual('');
- done();
+ ops.push(container.textContent);
});
+ expect(ops).toEqual(['Hello', '']);
});
it('does not re-render if state update is null', () => {
@@ -1192,7 +1193,7 @@ describe('ReactUpdates', () => {
// Will change once we switch to async by default
it('synchronously renders hidden subtrees', () => {
- let container = document.createElement('div');
+ const container = document.createElement('div');
let ops = [];
function Baz() {
diff --git a/src/renderers/shared/fiber/ReactFiberBeginWork.js b/src/renderers/shared/fiber/ReactFiberBeginWork.js
index 636b583708..dcbc697afe 100644
--- a/src/renderers/shared/fiber/ReactFiberBeginWork.js
+++ b/src/renderers/shared/fiber/ReactFiberBeginWork.js
@@ -77,7 +77,7 @@ module.exports = function(
getPriorityContext : () => PriorityLevel,
) {
- const { shouldSetTextContent } = config;
+ const { shouldSetTextContent, useSyncScheduling } = config;
const {
pushHostContext,
@@ -357,7 +357,8 @@ module.exports = function(
);
}
} else if (nextProps === null || memoizedProps === nextProps) {
- if (memoizedProps.hidden &&
+ if (!useSyncScheduling &&
+ memoizedProps.hidden &&
workInProgress.pendingWorkPriority !== OffscreenPriority) {
// This subtree still has work, but it should be deprioritized so we need
// to bail out and not do any work yet.
@@ -398,7 +399,8 @@ module.exports = function(
markRef(current, workInProgress);
- if (nextProps.hidden &&
+ if (!useSyncScheduling &&
+ nextProps.hidden &&
workInProgress.pendingWorkPriority !== OffscreenPriority) {
// If this host component is hidden, we can bail out on the children.
// We'll rerender the children later at the lower priority.