diff --git a/packages/react-dom/index.classic.fb.js b/packages/react-dom/index.classic.fb.js index ea9dd9aba257..0b16c0808368 100644 --- a/packages/react-dom/index.classic.fb.js +++ b/packages/react-dom/index.classic.fb.js @@ -30,8 +30,6 @@ export { unmountComponentAtNode, createRoot, createRoot as unstable_createRoot, - createBlockingRoot, - createBlockingRoot as unstable_createBlockingRoot, unstable_flushControlled, unstable_scheduleHydration, unstable_runWithPriority, diff --git a/packages/react-dom/index.experimental.js b/packages/react-dom/index.experimental.js index 9ed70f3959ec..e685ec6e8a1f 100644 --- a/packages/react-dom/index.experimental.js +++ b/packages/react-dom/index.experimental.js @@ -20,7 +20,6 @@ export { unmountComponentAtNode, // exposeConcurrentModeAPIs createRoot as unstable_createRoot, - createBlockingRoot as unstable_createBlockingRoot, unstable_flushControlled, unstable_scheduleHydration, // DO NOT USE: Temporarily exposing this to migrate off of Scheduler.runWithPriority. diff --git a/packages/react-dom/index.js b/packages/react-dom/index.js index 59825272c3a8..7adfaa4ad218 100644 --- a/packages/react-dom/index.js +++ b/packages/react-dom/index.js @@ -21,8 +21,6 @@ export { unmountComponentAtNode, createRoot, createRoot as unstable_createRoot, - createBlockingRoot, - createBlockingRoot as unstable_createBlockingRoot, unstable_flushControlled, unstable_scheduleHydration, unstable_runWithPriority, diff --git a/packages/react-dom/index.modern.fb.js b/packages/react-dom/index.modern.fb.js index addcce97749c..f91cc3cb8955 100644 --- a/packages/react-dom/index.modern.fb.js +++ b/packages/react-dom/index.modern.fb.js @@ -15,8 +15,6 @@ export { version, createRoot, createRoot as unstable_createRoot, - createBlockingRoot, - createBlockingRoot as unstable_createBlockingRoot, unstable_flushControlled, unstable_scheduleHydration, unstable_runWithPriority, diff --git a/packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.js b/packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.js index ee609d7c2e0c..ec3f19950a99 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.js @@ -593,33 +593,6 @@ describe('ReactDOMFiberAsync', () => { expect(containerC.textContent).toEqual('Finished'); }); - describe('createBlockingRoot', () => { - // @gate experimental - it('updates flush without yielding in the next event', () => { - const root = ReactDOM.unstable_createBlockingRoot(container); - - function Text(props) { - Scheduler.unstable_yieldValue(props.text); - return props.text; - } - - root.render( - <> - - - - , - ); - - // Nothing should have rendered yet - expect(container.textContent).toEqual(''); - - // Everything should render immediately in the next event - expect(Scheduler).toFlushExpired(['A', 'B', 'C']); - expect(container.textContent).toEqual('ABC'); - }); - }); - // @gate experimental it('unmounted roots should never clear newer root content from a container', () => { const ref = React.createRef(); diff --git a/packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js b/packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js index 2ad221d5fbcb..ec13c315157f 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js @@ -352,7 +352,7 @@ describe('ReactDOMServerPartialHydration', () => { }).toErrorDev( 'Warning: Cannot hydrate Suspense in legacy mode. Switch from ' + 'ReactDOM.hydrate(element, container) to ' + - 'ReactDOM.createBlockingRoot(container, { hydrate: true })' + + 'ReactDOM.createRoot(container, { hydrate: true })' + '.render(element) or remove the Suspense components from the server ' + 'rendered components.' + '\n in Suspense (at **)' + diff --git a/packages/react-dom/src/__tests__/ReactDOMServerSuspense-test.internal.js b/packages/react-dom/src/__tests__/ReactDOMServerSuspense-test.internal.js index 6c48b36bd107..7b28d572ccce 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerSuspense-test.internal.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerSuspense-test.internal.js @@ -127,7 +127,7 @@ describe('ReactDOMServerSuspense', () => { expect(divB.textContent).toBe('B'); act(() => { - const root = ReactDOM.createBlockingRoot(parent, {hydrate: true}); + const root = ReactDOM.createRoot(parent, {hydrate: true}); root.render(example); }); diff --git a/packages/react-dom/src/__tests__/ReactTestUtilsAct-test.js b/packages/react-dom/src/__tests__/ReactTestUtilsAct-test.js index 57807679e8eb..0496e26692da 100644 --- a/packages/react-dom/src/__tests__/ReactTestUtilsAct-test.js +++ b/packages/react-dom/src/__tests__/ReactTestUtilsAct-test.js @@ -72,33 +72,6 @@ describe('ReactTestUtils.act()', () => { runActTests('legacy mode', renderLegacy, unmountLegacy, rerenderLegacy); - // and then in blocking mode - if (__EXPERIMENTAL__) { - let blockingRoot = null; - const renderBatched = (el, dom) => { - blockingRoot = ReactDOM.unstable_createBlockingRoot(dom); - blockingRoot.render(el); - }; - - const unmountBatched = dom => { - if (blockingRoot !== null) { - blockingRoot.unmount(); - blockingRoot = null; - } - }; - - const rerenderBatched = el => { - blockingRoot.render(el); - }; - - runActTests( - 'blocking mode', - renderBatched, - unmountBatched, - rerenderBatched, - ); - } - describe('unacted effects', () => { function App() { React.useEffect(() => {}, []); @@ -124,19 +97,6 @@ describe('ReactTestUtils.act()', () => { ]); }); - // @gate experimental - it('warns in blocking mode', () => { - expect(() => { - const root = ReactDOM.unstable_createBlockingRoot( - document.createElement('div'), - ); - root.render(); - Scheduler.unstable_flushAll(); - }).toErrorDev([ - 'An update to App ran an effect, but was not wrapped in act(...)', - ]); - }); - // @gate experimental it('warns in concurrent mode', () => { expect(() => { @@ -731,14 +691,10 @@ function runActTests(label, render, unmount, rerender) { it('triggers fallbacks if available', async () => { if (label !== 'legacy mode') { - // FIXME: Support for Blocking* and Concurrent Mode were - // intentionally removed from the public version of `act`. It will - // be added back in a future major version, before Blocking and and - // Concurrent Mode are officially released. Consider disabling all - // non-Legacy tests in this suite until then. - // - // *Blocking Mode actually does happen to work, though - // not "officially" since it's an unreleased feature. + // FIXME: Support for Concurrent Root intentionally removed + // from the public version of `act`. It will be added back in + // a future major version, Concurrent Root officially released. + // Consider skipping all non-Legacy tests in this suite until then. return; } @@ -794,10 +750,8 @@ function runActTests(label, render, unmount, rerender) { // In Concurrent Mode, refresh transitions delay indefinitely. expect(document.querySelector('[data-test-id=spinner]')).toBeNull(); } else { - // In Legacy Mode and Blocking Mode, all fallbacks are forced to - // display, even during a refresh transition. - // TODO: Consider delaying indefinitely in Blocking Mode, to match - // Concurrent Mode semantics. + // In Legacy Mode, all fallbacks are forced to display, + // even during a refresh transition. expect( document.querySelector('[data-test-id=spinner]'), ).not.toBeNull(); diff --git a/packages/react-dom/src/__tests__/ReactUnmockedSchedulerWarning-test.js b/packages/react-dom/src/__tests__/ReactUnmockedSchedulerWarning-test.js index 435b4989c115..79437e7f5c76 100644 --- a/packages/react-dom/src/__tests__/ReactUnmockedSchedulerWarning-test.js +++ b/packages/react-dom/src/__tests__/ReactUnmockedSchedulerWarning-test.js @@ -43,22 +43,3 @@ it('should warn when rendering in concurrent mode', () => { ReactDOM.unstable_createRoot(document.createElement('div')).render(); }).toErrorDev([]); }); - -// @gate experimental -it('should warn when rendering in blocking mode', () => { - expect(() => { - ReactDOM.unstable_createBlockingRoot(document.createElement('div')).render( - , - ); - }).toErrorDev( - 'In Concurrent or Sync modes, the "scheduler" module needs to be mocked ' + - 'to guarantee consistent behaviour across tests and browsers.', - {withoutStack: true}, - ); - // does not warn twice - expect(() => { - ReactDOM.unstable_createBlockingRoot(document.createElement('div')).render( - , - ); - }).toErrorDev([]); -}); diff --git a/packages/react-dom/src/client/ReactDOM.js b/packages/react-dom/src/client/ReactDOM.js index 66ae001c3b27..7cff285a938d 100644 --- a/packages/react-dom/src/client/ReactDOM.js +++ b/packages/react-dom/src/client/ReactDOM.js @@ -18,7 +18,7 @@ import { unstable_renderSubtreeIntoContainer, unmountComponentAtNode, } from './ReactDOMLegacy'; -import {createRoot, createBlockingRoot, isValidContainer} from './ReactDOMRoot'; +import {createRoot, isValidContainer} from './ReactDOMRoot'; import {createEventHandle} from './ReactDOMEventHandle'; import { @@ -201,7 +201,6 @@ export { unmountComponentAtNode, // exposeConcurrentModeAPIs createRoot, - createBlockingRoot, flushControlled as unstable_flushControlled, scheduleHydration as unstable_scheduleHydration, // Disabled behind disableUnstableRenderSubtreeIntoContainer diff --git a/packages/react-dom/src/client/ReactDOMRoot.js b/packages/react-dom/src/client/ReactDOMRoot.js index 62a72dc22961..56532d5d6748 100644 --- a/packages/react-dom/src/client/ReactDOMRoot.js +++ b/packages/react-dom/src/client/ReactDOMRoot.js @@ -51,25 +51,17 @@ import { registerMutableSourceForHydration, } from 'react-reconciler/src/ReactFiberReconciler'; import invariant from 'shared/invariant'; -import { - BlockingRoot, - ConcurrentRoot, - LegacyRoot, -} from 'react-reconciler/src/ReactRootTags'; +import {ConcurrentRoot, LegacyRoot} from 'react-reconciler/src/ReactRootTags'; function ReactDOMRoot(container: Container, options: void | RootOptions) { this._internalRoot = createRootImpl(container, ConcurrentRoot, options); } -function ReactDOMBlockingRoot( - container: Container, - tag: RootTag, - options: void | RootOptions, -) { - this._internalRoot = createRootImpl(container, tag, options); +function ReactDOMLegacyRoot(container: Container, options: void | RootOptions) { + this._internalRoot = createRootImpl(container, LegacyRoot, options); } -ReactDOMRoot.prototype.render = ReactDOMBlockingRoot.prototype.render = function( +ReactDOMRoot.prototype.render = ReactDOMLegacyRoot.prototype.render = function( children: ReactNodeList, ): void { const root = this._internalRoot; @@ -99,7 +91,7 @@ ReactDOMRoot.prototype.render = ReactDOMBlockingRoot.prototype.render = function updateContainer(children, root, null, null); }; -ReactDOMRoot.prototype.unmount = ReactDOMBlockingRoot.prototype.unmount = function(): void { +ReactDOMRoot.prototype.unmount = ReactDOMLegacyRoot.prototype.unmount = function(): void { if (__DEV__) { if (typeof arguments[0] === 'function') { console.error( @@ -169,23 +161,11 @@ export function createRoot( return new ReactDOMRoot(container, options); } -export function createBlockingRoot( - container: Container, - options?: RootOptions, -): RootType { - invariant( - isValidContainer(container), - 'createRoot(...): Target container is not a DOM element.', - ); - warnIfReactDOMContainerInDEV(container); - return new ReactDOMBlockingRoot(container, BlockingRoot, options); -} - export function createLegacyRoot( container: Container, options?: RootOptions, ): RootType { - return new ReactDOMBlockingRoot(container, LegacyRoot, options); + return new ReactDOMLegacyRoot(container, options); } export function isValidContainer(node: mixed): boolean { diff --git a/packages/react-noop-renderer/src/ReactNoop.js b/packages/react-noop-renderer/src/ReactNoop.js index 8305dd6d8641..c09fa2d8000f 100644 --- a/packages/react-noop-renderer/src/ReactNoop.js +++ b/packages/react-noop-renderer/src/ReactNoop.js @@ -23,7 +23,6 @@ export const { getPendingChildren, getOrCreateRootContainer, createRoot, - createBlockingRoot, createLegacyRoot, getChildrenAsJSX, getPendingChildrenAsJSX, diff --git a/packages/react-noop-renderer/src/ReactNoopPersistent.js b/packages/react-noop-renderer/src/ReactNoopPersistent.js index c4a73cdfb81b..97876990a9b5 100644 --- a/packages/react-noop-renderer/src/ReactNoopPersistent.js +++ b/packages/react-noop-renderer/src/ReactNoopPersistent.js @@ -23,7 +23,6 @@ export const { getPendingChildren, getOrCreateRootContainer, createRoot, - createBlockingRoot, createLegacyRoot, getChildrenAsJSX, getPendingChildrenAsJSX, diff --git a/packages/react-noop-renderer/src/createReactNoop.js b/packages/react-noop-renderer/src/createReactNoop.js index 743470966b3f..9eef962f1339 100644 --- a/packages/react-noop-renderer/src/createReactNoop.js +++ b/packages/react-noop-renderer/src/createReactNoop.js @@ -21,11 +21,7 @@ import type {RootTag} from 'react-reconciler/src/ReactRootTags'; import * as Scheduler from 'scheduler/unstable_mock'; import {REACT_FRAGMENT_TYPE, REACT_ELEMENT_TYPE} from 'shared/ReactSymbols'; -import { - ConcurrentRoot, - BlockingRoot, - LegacyRoot, -} from 'react-reconciler/src/ReactRootTags'; +import {ConcurrentRoot, LegacyRoot} from 'react-reconciler/src/ReactRootTags'; import { enableNativeEventPriorityInference, @@ -756,33 +752,6 @@ function createReactNoop(reconciler: Function, useMutation: boolean) { }; }, - createBlockingRoot() { - const container = { - rootID: '' + idCounter++, - pendingChildren: [], - children: [], - }; - const fiberRoot = NoopRenderer.createContainer( - container, - BlockingRoot, - false, - null, - null, - ); - return { - _Scheduler: Scheduler, - render(children: ReactNodeList) { - NoopRenderer.updateContainer(children, fiberRoot, null, null); - }, - getChildren() { - return getChildren(container); - }, - getChildrenAsJSX() { - return getChildrenAsJSX(container); - }, - }; - }, - createLegacyRoot() { const container = { rootID: '' + idCounter++, diff --git a/packages/react-reconciler/src/ReactFiber.new.js b/packages/react-reconciler/src/ReactFiber.new.js index f1a0f56b2340..b386eac09f81 100644 --- a/packages/react-reconciler/src/ReactFiber.new.js +++ b/packages/react-reconciler/src/ReactFiber.new.js @@ -26,7 +26,7 @@ import { enableScopeAPI, } from 'shared/ReactFeatureFlags'; import {NoFlags, Placement, StaticMask} from './ReactFiberFlags'; -import {ConcurrentRoot, BlockingRoot} from './ReactRootTags'; +import {ConcurrentRoot} from './ReactRootTags'; import { IndeterminateComponent, ClassComponent, @@ -68,7 +68,6 @@ import { ProfileMode, StrictLegacyMode, StrictEffectsMode, - BlockingMode, } from './ReactTypeOfMode'; import { REACT_FORWARD_REF_TYPE, @@ -427,25 +426,7 @@ export function createHostRootFiber( ): Fiber { let mode; if (tag === ConcurrentRoot) { - mode = ConcurrentMode | BlockingMode; - if (strictModeLevelOverride !== null) { - if (strictModeLevelOverride >= 1) { - mode |= StrictLegacyMode; - } - if (enableStrictEffects) { - if (strictModeLevelOverride >= 2) { - mode |= StrictEffectsMode; - } - } - } else { - if (enableStrictEffects && createRootStrictEffectsByDefault) { - mode |= StrictLegacyMode | StrictEffectsMode; - } else { - mode |= StrictLegacyMode; - } - } - } else if (tag === BlockingRoot) { - mode = BlockingMode; + mode = ConcurrentMode; if (strictModeLevelOverride !== null) { if (strictModeLevelOverride >= 1) { mode |= StrictLegacyMode; diff --git a/packages/react-reconciler/src/ReactFiber.old.js b/packages/react-reconciler/src/ReactFiber.old.js index 6419fd6b261b..603feb345ff9 100644 --- a/packages/react-reconciler/src/ReactFiber.old.js +++ b/packages/react-reconciler/src/ReactFiber.old.js @@ -26,7 +26,7 @@ import { enableScopeAPI, } from 'shared/ReactFeatureFlags'; import {NoFlags, Placement, StaticMask} from './ReactFiberFlags'; -import {ConcurrentRoot, BlockingRoot} from './ReactRootTags'; +import {ConcurrentRoot} from './ReactRootTags'; import { IndeterminateComponent, ClassComponent, @@ -68,7 +68,6 @@ import { ProfileMode, StrictLegacyMode, StrictEffectsMode, - BlockingMode, } from './ReactTypeOfMode'; import { REACT_FORWARD_REF_TYPE, @@ -427,25 +426,7 @@ export function createHostRootFiber( ): Fiber { let mode; if (tag === ConcurrentRoot) { - mode = ConcurrentMode | BlockingMode; - if (strictModeLevelOverride !== null) { - if (strictModeLevelOverride >= 1) { - mode |= StrictLegacyMode; - } - if (enableStrictEffects) { - if (strictModeLevelOverride >= 2) { - mode |= StrictEffectsMode; - } - } - } else { - if (enableStrictEffects && createRootStrictEffectsByDefault) { - mode |= StrictLegacyMode | StrictEffectsMode; - } else { - mode |= StrictLegacyMode; - } - } - } else if (tag === BlockingRoot) { - mode = BlockingMode; + mode = ConcurrentMode; if (strictModeLevelOverride !== null) { if (strictModeLevelOverride >= 1) { mode |= StrictLegacyMode; diff --git a/packages/react-reconciler/src/ReactFiberBeginWork.new.js b/packages/react-reconciler/src/ReactFiberBeginWork.new.js index 6dffcc328927..a4868edfd643 100644 --- a/packages/react-reconciler/src/ReactFiberBeginWork.new.js +++ b/packages/react-reconciler/src/ReactFiberBeginWork.new.js @@ -126,7 +126,6 @@ import { NoMode, ProfileMode, StrictLegacyMode, - BlockingMode, } from './ReactTypeOfMode'; import { shouldSetTextContent, @@ -604,7 +603,6 @@ function updateOffscreenComponent( // Rendering a hidden tree. if ((workInProgress.mode & ConcurrentMode) === NoMode) { // In legacy sync mode, don't defer the subtree. Render it now. - // TODO: Figure out what we should do in Blocking mode. const nextState: OffscreenState = { baseLanes: NoLanes, cachePool: null, @@ -2117,7 +2115,10 @@ function mountSuspenseFallbackChildren( let primaryChildFragment; let fallbackChildFragment; - if ((mode & BlockingMode) === NoMode && progressedPrimaryFragment !== null) { + if ( + (mode & ConcurrentMode) === NoMode && + progressedPrimaryFragment !== null + ) { // In legacy mode, we commit the primary tree as if it successfully // completed, even though it's in an inconsistent state. primaryChildFragment = progressedPrimaryFragment; @@ -2189,7 +2190,7 @@ function updateSuspensePrimaryChildren( children: primaryChildren, }, ); - if ((workInProgress.mode & BlockingMode) === NoMode) { + if ((workInProgress.mode & ConcurrentMode) === NoMode) { primaryChildFragment.lanes = renderLanes; } primaryChildFragment.return = workInProgress; @@ -2230,7 +2231,7 @@ function updateSuspenseFallbackChildren( if ( // In legacy mode, we commit the primary tree as if it successfully // completed, even though it's in an inconsistent state. - (mode & BlockingMode) === NoMode && + (mode & ConcurrentMode) === NoMode && // Make sure we're on the second pass, i.e. the primary child fragment was // already cloned. In legacy mode, the only case where this isn't true is // when DevTools forces us to display a fallback; we skip the first render @@ -2352,7 +2353,7 @@ function mountSuspenseFallbackAfterRetryWithoutHydrating( primaryChildFragment.sibling = fallbackChildFragment; workInProgress.child = primaryChildFragment; - if ((workInProgress.mode & BlockingMode) !== NoMode) { + if ((workInProgress.mode & ConcurrentMode) !== NoMode) { // We will have dropped the effect list which contains the // deletion. We need to reconcile to delete the current child. reconcileChildFibers(workInProgress, current.child, null, renderLanes); @@ -2368,12 +2369,12 @@ function mountDehydratedSuspenseComponent( ): null | Fiber { // During the first pass, we'll bail out and not drill into the children. // Instead, we'll leave the content in place and try to hydrate it later. - if ((workInProgress.mode & BlockingMode) === NoMode) { + if ((workInProgress.mode & ConcurrentMode) === NoMode) { if (__DEV__) { console.error( 'Cannot hydrate Suspense in legacy mode. Switch from ' + 'ReactDOM.hydrate(element, container) to ' + - 'ReactDOM.createBlockingRoot(container, { hydrate: true })' + + 'ReactDOM.createRoot(container, { hydrate: true })' + '.render(element) or remove the Suspense components from ' + 'the server rendered components.', ); @@ -2426,7 +2427,7 @@ function updateDehydratedSuspenseComponent( ); } - if ((workInProgress.mode & BlockingMode) === NoMode) { + if ((workInProgress.mode & ConcurrentMode) === NoMode) { return retrySuspenseComponentWithoutHydrating( current, workInProgress, @@ -2831,7 +2832,7 @@ function updateSuspenseListComponent( } pushSuspenseContext(workInProgress, suspenseContext); - if ((workInProgress.mode & BlockingMode) === NoMode) { + if ((workInProgress.mode & ConcurrentMode) === NoMode) { // In legacy mode, SuspenseList doesn't work so we just // use make it a noop by treating it as the default revealOrder. workInProgress.memoizedState = null; diff --git a/packages/react-reconciler/src/ReactFiberBeginWork.old.js b/packages/react-reconciler/src/ReactFiberBeginWork.old.js index 7801afe9fa23..c706200815d7 100644 --- a/packages/react-reconciler/src/ReactFiberBeginWork.old.js +++ b/packages/react-reconciler/src/ReactFiberBeginWork.old.js @@ -126,7 +126,6 @@ import { NoMode, ProfileMode, StrictLegacyMode, - BlockingMode, } from './ReactTypeOfMode'; import { shouldSetTextContent, @@ -604,7 +603,6 @@ function updateOffscreenComponent( // Rendering a hidden tree. if ((workInProgress.mode & ConcurrentMode) === NoMode) { // In legacy sync mode, don't defer the subtree. Render it now. - // TODO: Figure out what we should do in Blocking mode. const nextState: OffscreenState = { baseLanes: NoLanes, cachePool: null, @@ -2117,7 +2115,10 @@ function mountSuspenseFallbackChildren( let primaryChildFragment; let fallbackChildFragment; - if ((mode & BlockingMode) === NoMode && progressedPrimaryFragment !== null) { + if ( + (mode & ConcurrentMode) === NoMode && + progressedPrimaryFragment !== null + ) { // In legacy mode, we commit the primary tree as if it successfully // completed, even though it's in an inconsistent state. primaryChildFragment = progressedPrimaryFragment; @@ -2189,7 +2190,7 @@ function updateSuspensePrimaryChildren( children: primaryChildren, }, ); - if ((workInProgress.mode & BlockingMode) === NoMode) { + if ((workInProgress.mode & ConcurrentMode) === NoMode) { primaryChildFragment.lanes = renderLanes; } primaryChildFragment.return = workInProgress; @@ -2230,7 +2231,7 @@ function updateSuspenseFallbackChildren( if ( // In legacy mode, we commit the primary tree as if it successfully // completed, even though it's in an inconsistent state. - (mode & BlockingMode) === NoMode && + (mode & ConcurrentMode) === NoMode && // Make sure we're on the second pass, i.e. the primary child fragment was // already cloned. In legacy mode, the only case where this isn't true is // when DevTools forces us to display a fallback; we skip the first render @@ -2352,7 +2353,7 @@ function mountSuspenseFallbackAfterRetryWithoutHydrating( primaryChildFragment.sibling = fallbackChildFragment; workInProgress.child = primaryChildFragment; - if ((workInProgress.mode & BlockingMode) !== NoMode) { + if ((workInProgress.mode & ConcurrentMode) !== NoMode) { // We will have dropped the effect list which contains the // deletion. We need to reconcile to delete the current child. reconcileChildFibers(workInProgress, current.child, null, renderLanes); @@ -2368,12 +2369,12 @@ function mountDehydratedSuspenseComponent( ): null | Fiber { // During the first pass, we'll bail out and not drill into the children. // Instead, we'll leave the content in place and try to hydrate it later. - if ((workInProgress.mode & BlockingMode) === NoMode) { + if ((workInProgress.mode & ConcurrentMode) === NoMode) { if (__DEV__) { console.error( 'Cannot hydrate Suspense in legacy mode. Switch from ' + 'ReactDOM.hydrate(element, container) to ' + - 'ReactDOM.createBlockingRoot(container, { hydrate: true })' + + 'ReactDOM.createRoot(container, { hydrate: true })' + '.render(element) or remove the Suspense components from ' + 'the server rendered components.', ); @@ -2426,7 +2427,7 @@ function updateDehydratedSuspenseComponent( ); } - if ((workInProgress.mode & BlockingMode) === NoMode) { + if ((workInProgress.mode & ConcurrentMode) === NoMode) { return retrySuspenseComponentWithoutHydrating( current, workInProgress, @@ -2831,7 +2832,7 @@ function updateSuspenseListComponent( } pushSuspenseContext(workInProgress, suspenseContext); - if ((workInProgress.mode & BlockingMode) === NoMode) { + if ((workInProgress.mode & ConcurrentMode) === NoMode) { // In legacy mode, SuspenseList doesn't work so we just // use make it a noop by treating it as the default revealOrder. workInProgress.memoizedState = null; diff --git a/packages/react-reconciler/src/ReactFiberCompleteWork.new.js b/packages/react-reconciler/src/ReactFiberCompleteWork.new.js index 47f65d2da6ef..1dcc0ec9c87d 100644 --- a/packages/react-reconciler/src/ReactFiberCompleteWork.new.js +++ b/packages/react-reconciler/src/ReactFiberCompleteWork.new.js @@ -55,12 +55,7 @@ import { LegacyHiddenComponent, CacheComponent, } from './ReactWorkTags'; -import { - NoMode, - BlockingMode, - ConcurrentMode, - ProfileMode, -} from './ReactTypeOfMode'; +import {NoMode, ConcurrentMode, ProfileMode} from './ReactTypeOfMode'; import { Ref, Update, @@ -1059,12 +1054,10 @@ function completeWork( } if (nextDidTimeout && !prevDidTimeout) { - // If this subtree is running in blocking mode we can suspend, - // otherwise we won't suspend. // TODO: This will still suspend a synchronous tree if anything // in the concurrent tree already suspended during this render. // This is a known bug. - if ((workInProgress.mode & BlockingMode) !== NoMode) { + if ((workInProgress.mode & ConcurrentMode) !== NoMode) { // TODO: Move this back to throwException because this is too late // if this is a large tree which is common for initial loads. We // don't know if we should restart a render or not until we get diff --git a/packages/react-reconciler/src/ReactFiberCompleteWork.old.js b/packages/react-reconciler/src/ReactFiberCompleteWork.old.js index df878d24e76a..dc1112d3b88f 100644 --- a/packages/react-reconciler/src/ReactFiberCompleteWork.old.js +++ b/packages/react-reconciler/src/ReactFiberCompleteWork.old.js @@ -55,12 +55,7 @@ import { LegacyHiddenComponent, CacheComponent, } from './ReactWorkTags'; -import { - NoMode, - BlockingMode, - ConcurrentMode, - ProfileMode, -} from './ReactTypeOfMode'; +import {NoMode, ConcurrentMode, ProfileMode} from './ReactTypeOfMode'; import { Ref, Update, @@ -1059,12 +1054,10 @@ function completeWork( } if (nextDidTimeout && !prevDidTimeout) { - // If this subtree is running in blocking mode we can suspend, - // otherwise we won't suspend. // TODO: This will still suspend a synchronous tree if anything // in the concurrent tree already suspended during this render. // This is a known bug. - if ((workInProgress.mode & BlockingMode) !== NoMode) { + if ((workInProgress.mode & ConcurrentMode) !== NoMode) { // TODO: Move this back to throwException because this is too late // if this is a large tree which is common for initial loads. We // don't know if we should restart a render or not until we get diff --git a/packages/react-reconciler/src/ReactFiberHooks.new.js b/packages/react-reconciler/src/ReactFiberHooks.new.js index 9d1fa5f82ed8..80d62f25967e 100644 --- a/packages/react-reconciler/src/ReactFiberHooks.new.js +++ b/packages/react-reconciler/src/ReactFiberHooks.new.js @@ -34,7 +34,7 @@ import { import { NoMode, - BlockingMode, + ConcurrentMode, DebugTracingMode, StrictEffectsMode, } from './ReactTypeOfMode'; @@ -1829,7 +1829,7 @@ function mountOpaqueIdentifier(): OpaqueIDType | void { const setId = mountState(id)[1]; - if ((currentlyRenderingFiber.mode & BlockingMode) === NoMode) { + if ((currentlyRenderingFiber.mode & ConcurrentMode) === NoMode) { if ( __DEV__ && enableStrictEffects && diff --git a/packages/react-reconciler/src/ReactFiberHooks.old.js b/packages/react-reconciler/src/ReactFiberHooks.old.js index 61f1a17452e4..2bdead48f33b 100644 --- a/packages/react-reconciler/src/ReactFiberHooks.old.js +++ b/packages/react-reconciler/src/ReactFiberHooks.old.js @@ -34,7 +34,7 @@ import { import { NoMode, - BlockingMode, + ConcurrentMode, DebugTracingMode, StrictEffectsMode, } from './ReactTypeOfMode'; @@ -1829,7 +1829,7 @@ function mountOpaqueIdentifier(): OpaqueIDType | void { const setId = mountState(id)[1]; - if ((currentlyRenderingFiber.mode & BlockingMode) === NoMode) { + if ((currentlyRenderingFiber.mode & ConcurrentMode) === NoMode) { if ( __DEV__ && enableStrictEffects && diff --git a/packages/react-reconciler/src/ReactFiberRoot.new.js b/packages/react-reconciler/src/ReactFiberRoot.new.js index ae6a5bdb596f..f06925e10fbe 100644 --- a/packages/react-reconciler/src/ReactFiberRoot.new.js +++ b/packages/react-reconciler/src/ReactFiberRoot.new.js @@ -25,7 +25,7 @@ import { } from 'shared/ReactFeatureFlags'; import {unstable_getThreadID} from 'scheduler/tracing'; import {initializeUpdateQueue} from './ReactUpdateQueue.new'; -import {LegacyRoot, BlockingRoot, ConcurrentRoot} from './ReactRootTags'; +import {LegacyRoot, ConcurrentRoot} from './ReactRootTags'; function FiberRootNode(containerInfo, tag, hydrate) { this.tag = tag; @@ -73,9 +73,6 @@ function FiberRootNode(containerInfo, tag, hydrate) { if (__DEV__) { switch (tag) { - case BlockingRoot: - this._debugRootType = 'createBlockingRoot()'; - break; case ConcurrentRoot: this._debugRootType = 'createRoot()'; break; diff --git a/packages/react-reconciler/src/ReactFiberRoot.old.js b/packages/react-reconciler/src/ReactFiberRoot.old.js index 0c0d45c09872..712803920ebb 100644 --- a/packages/react-reconciler/src/ReactFiberRoot.old.js +++ b/packages/react-reconciler/src/ReactFiberRoot.old.js @@ -25,7 +25,7 @@ import { } from 'shared/ReactFeatureFlags'; import {unstable_getThreadID} from 'scheduler/tracing'; import {initializeUpdateQueue} from './ReactUpdateQueue.old'; -import {LegacyRoot, BlockingRoot, ConcurrentRoot} from './ReactRootTags'; +import {LegacyRoot, ConcurrentRoot} from './ReactRootTags'; function FiberRootNode(containerInfo, tag, hydrate) { this.tag = tag; @@ -73,9 +73,6 @@ function FiberRootNode(containerInfo, tag, hydrate) { if (__DEV__) { switch (tag) { - case BlockingRoot: - this._debugRootType = 'createBlockingRoot()'; - break; case ConcurrentRoot: this._debugRootType = 'createRoot()'; break; diff --git a/packages/react-reconciler/src/ReactFiberThrow.new.js b/packages/react-reconciler/src/ReactFiberThrow.new.js index af199f0aa8e8..0f7dd89263d1 100644 --- a/packages/react-reconciler/src/ReactFiberThrow.new.js +++ b/packages/react-reconciler/src/ReactFiberThrow.new.js @@ -34,7 +34,7 @@ import { ForceUpdateForLegacySuspense, } from './ReactFiberFlags'; import {shouldCaptureSuspense} from './ReactFiberSuspenseComponent.new'; -import {NoMode, BlockingMode, DebugTracingMode} from './ReactTypeOfMode'; +import {NoMode, ConcurrentMode, DebugTracingMode} from './ReactTypeOfMode'; import { enableDebugTracing, enableSchedulingProfiler, @@ -214,7 +214,7 @@ function throwException( // A legacy mode Suspense quirk, only relevant to hook components. const tag = sourceFiber.tag; if ( - (sourceFiber.mode & BlockingMode) === NoMode && + (sourceFiber.mode & ConcurrentMode) === NoMode && (tag === FunctionComponent || tag === ForwardRef || tag === SimpleMemoComponent) @@ -255,13 +255,13 @@ function throwException( wakeables.add(wakeable); } - // If the boundary is outside of blocking mode, we should *not* + // If the boundary is in legacy mode, we should *not* // suspend the commit. Pretend as if the suspended component rendered // null and keep rendering. In the commit phase, we'll schedule a // subsequent synchronous update to re-render the Suspense. // // Note: It doesn't matter whether the component that suspended was - // inside a blocking mode tree. If the Suspense is outside of it, we + // inside a concurrent mode tree. If the Suspense is outside of it, we // should *not* suspend the commit. // // If the suspense boundary suspended itself suspended, we don't have to @@ -269,7 +269,7 @@ function throwException( // directly do a second pass over the fallback in this render and // pretend we meant to render that directly. if ( - (workInProgress.mode & BlockingMode) === NoMode && + (workInProgress.mode & ConcurrentMode) === NoMode && workInProgress !== returnFiber ) { workInProgress.flags |= DidCapture; diff --git a/packages/react-reconciler/src/ReactFiberThrow.old.js b/packages/react-reconciler/src/ReactFiberThrow.old.js index 6ae53d02fc5c..f7ceb05202cb 100644 --- a/packages/react-reconciler/src/ReactFiberThrow.old.js +++ b/packages/react-reconciler/src/ReactFiberThrow.old.js @@ -34,7 +34,7 @@ import { ForceUpdateForLegacySuspense, } from './ReactFiberFlags'; import {shouldCaptureSuspense} from './ReactFiberSuspenseComponent.old'; -import {NoMode, BlockingMode, DebugTracingMode} from './ReactTypeOfMode'; +import {NoMode, ConcurrentMode, DebugTracingMode} from './ReactTypeOfMode'; import { enableDebugTracing, enableSchedulingProfiler, @@ -214,7 +214,7 @@ function throwException( // A legacy mode Suspense quirk, only relevant to hook components. const tag = sourceFiber.tag; if ( - (sourceFiber.mode & BlockingMode) === NoMode && + (sourceFiber.mode & ConcurrentMode) === NoMode && (tag === FunctionComponent || tag === ForwardRef || tag === SimpleMemoComponent) @@ -255,13 +255,13 @@ function throwException( wakeables.add(wakeable); } - // If the boundary is outside of blocking mode, we should *not* + // If the boundary is in legacy mode, we should *not* // suspend the commit. Pretend as if the suspended component rendered // null and keep rendering. In the commit phase, we'll schedule a // subsequent synchronous update to re-render the Suspense. // // Note: It doesn't matter whether the component that suspended was - // inside a blocking mode tree. If the Suspense is outside of it, we + // inside a concurrent mode tree. If the Suspense is outside of it, we // should *not* suspend the commit. // // If the suspense boundary suspended itself suspended, we don't have to @@ -269,7 +269,7 @@ function throwException( // directly do a second pass over the fallback in this render and // pretend we meant to render that directly. if ( - (workInProgress.mode & BlockingMode) === NoMode && + (workInProgress.mode & ConcurrentMode) === NoMode && workInProgress !== returnFiber ) { workInProgress.flags |= DidCapture; diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.new.js b/packages/react-reconciler/src/ReactFiberWorkLoop.new.js index 7caee0787251..b404837cb25d 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.new.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.new.js @@ -106,7 +106,6 @@ import { NoMode, StrictLegacyMode, ProfileMode, - BlockingMode, ConcurrentMode, } from './ReactTypeOfMode'; import { @@ -392,7 +391,7 @@ export function getCurrentTime() { export function requestUpdateLane(fiber: Fiber): Lane { // Special cases const mode = fiber.mode; - if ((mode & BlockingMode) === NoMode) { + if ((mode & ConcurrentMode) === NoMode) { return (SyncLane: Lane); } else if ((mode & ConcurrentMode) === NoMode) { return getCurrentPriorityLevel() === ImmediateSchedulerPriority @@ -483,7 +482,7 @@ function requestRetryLane(fiber: Fiber) { // Special cases const mode = fiber.mode; - if ((mode & BlockingMode) === NoMode) { + if ((mode & ConcurrentMode) === NoMode) { return (SyncLane: Lane); } else if ((mode & ConcurrentMode) === NoMode) { return getCurrentPriorityLevel() === ImmediateSchedulerPriority @@ -677,7 +676,7 @@ export function isInterleavedUpdate(fiber: Fiber, lane: Lane) { // Requires some refactoring. Not a big deal though since it's rare for // concurrent apps to have more than a single root. workInProgressRoot !== null && - (fiber.mode & BlockingMode) !== NoMode && + (fiber.mode & ConcurrentMode) !== NoMode && // If this is a render phase update (i.e. UNSAFE_componentWillReceiveProps), // then don't treat this as an interleaved update. This pattern is // accompanied by a warning but we haven't fully deprecated it yet. We can @@ -2625,7 +2624,7 @@ function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { return; } - if (!(fiber.mode & (BlockingMode | ConcurrentMode))) { + if (!(fiber.mode & ConcurrentMode)) { return; } @@ -3004,7 +3003,7 @@ export function warnIfUnmockedScheduler(fiber: Fiber) { didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined ) { - if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) { + if (fiber.mode & ConcurrentMode) { didWarnAboutUnmockedScheduler = true; console.error( 'In Concurrent or Sync modes, the "scheduler" module needs to be mocked ' + diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.old.js b/packages/react-reconciler/src/ReactFiberWorkLoop.old.js index 1467929ce459..0a366eece732 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.old.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.old.js @@ -106,7 +106,6 @@ import { NoMode, StrictLegacyMode, ProfileMode, - BlockingMode, ConcurrentMode, } from './ReactTypeOfMode'; import { @@ -392,7 +391,7 @@ export function getCurrentTime() { export function requestUpdateLane(fiber: Fiber): Lane { // Special cases const mode = fiber.mode; - if ((mode & BlockingMode) === NoMode) { + if ((mode & ConcurrentMode) === NoMode) { return (SyncLane: Lane); } else if ((mode & ConcurrentMode) === NoMode) { return getCurrentPriorityLevel() === ImmediateSchedulerPriority @@ -483,7 +482,7 @@ function requestRetryLane(fiber: Fiber) { // Special cases const mode = fiber.mode; - if ((mode & BlockingMode) === NoMode) { + if ((mode & ConcurrentMode) === NoMode) { return (SyncLane: Lane); } else if ((mode & ConcurrentMode) === NoMode) { return getCurrentPriorityLevel() === ImmediateSchedulerPriority @@ -677,7 +676,7 @@ export function isInterleavedUpdate(fiber: Fiber, lane: Lane) { // Requires some refactoring. Not a big deal though since it's rare for // concurrent apps to have more than a single root. workInProgressRoot !== null && - (fiber.mode & BlockingMode) !== NoMode && + (fiber.mode & ConcurrentMode) !== NoMode && // If this is a render phase update (i.e. UNSAFE_componentWillReceiveProps), // then don't treat this as an interleaved update. This pattern is // accompanied by a warning but we haven't fully deprecated it yet. We can @@ -2625,7 +2624,7 @@ function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { return; } - if (!(fiber.mode & (BlockingMode | ConcurrentMode))) { + if (!(fiber.mode & ConcurrentMode)) { return; } @@ -3004,7 +3003,7 @@ export function warnIfUnmockedScheduler(fiber: Fiber) { didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined ) { - if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) { + if (fiber.mode & ConcurrentMode) { didWarnAboutUnmockedScheduler = true; console.error( 'In Concurrent or Sync modes, the "scheduler" module needs to be mocked ' + diff --git a/packages/react-reconciler/src/ReactRootTags.js b/packages/react-reconciler/src/ReactRootTags.js index 409f4bd931a7..cda44d6e1ed5 100644 --- a/packages/react-reconciler/src/ReactRootTags.js +++ b/packages/react-reconciler/src/ReactRootTags.js @@ -7,8 +7,7 @@ * @flow */ -export type RootTag = 0 | 1 | 2; +export type RootTag = 0 | 1; export const LegacyRoot = 0; -export const BlockingRoot = 1; -export const ConcurrentRoot = 2; +export const ConcurrentRoot = 1; diff --git a/packages/react-reconciler/src/ReactTypeOfMode.js b/packages/react-reconciler/src/ReactTypeOfMode.js index a6499be7aca1..466363fabd4e 100644 --- a/packages/react-reconciler/src/ReactTypeOfMode.js +++ b/packages/react-reconciler/src/ReactTypeOfMode.js @@ -10,10 +10,9 @@ export type TypeOfMode = number; export const NoMode = /* */ 0b000000; -// TODO: Remove BlockingMode and ConcurrentMode by reading from the root tag instead -export const BlockingMode = /* */ 0b000001; -export const ConcurrentMode = /* */ 0b000010; -export const ProfileMode = /* */ 0b000100; -export const DebugTracingMode = /* */ 0b001000; -export const StrictLegacyMode = /* */ 0b010000; -export const StrictEffectsMode = /* */ 0b100000; +// TODO: Remove ConcurrentMode by reading from the root tag instead +export const ConcurrentMode = /* */ 0b000001; +export const ProfileMode = /* */ 0b000010; +export const DebugTracingMode = /* */ 0b000100; +export const StrictLegacyMode = /* */ 0b001000; +export const StrictEffectsMode = /* */ 0b010000; diff --git a/packages/react-reconciler/src/__tests__/ReactBatchedMode-test.internal.js b/packages/react-reconciler/src/__tests__/ReactBatchedMode-test.internal.js deleted file mode 100644 index c6af59fbd915..000000000000 --- a/packages/react-reconciler/src/__tests__/ReactBatchedMode-test.internal.js +++ /dev/null @@ -1,167 +0,0 @@ -let React; -let ReactFeatureFlags; -let ReactNoop; -let Scheduler; -let ReactCache; -let Suspense; -let TextResource; - -describe('ReactBlockingMode', () => { - beforeEach(() => { - jest.resetModules(); - ReactFeatureFlags = require('shared/ReactFeatureFlags'); - - ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = false; - React = require('react'); - ReactNoop = require('react-noop-renderer'); - Scheduler = require('scheduler'); - ReactCache = require('react-cache'); - Suspense = React.Suspense; - - TextResource = ReactCache.unstable_createResource( - ([text, ms = 0]) => { - return new Promise((resolve, reject) => - setTimeout(() => { - Scheduler.unstable_yieldValue(`Promise resolved [${text}]`); - resolve(text); - }, ms), - ); - }, - ([text, ms]) => text, - ); - }); - - function Text(props) { - Scheduler.unstable_yieldValue(props.text); - return props.text; - } - - function AsyncText(props) { - const text = props.text; - try { - TextResource.read([props.text, props.ms]); - Scheduler.unstable_yieldValue(text); - return props.text; - } catch (promise) { - if (typeof promise.then === 'function') { - Scheduler.unstable_yieldValue(`Suspend! [${text}]`); - } else { - Scheduler.unstable_yieldValue(`Error! [${text}]`); - } - throw promise; - } - } - - it('updates flush without yielding in the next event', () => { - const root = ReactNoop.createBlockingRoot(); - - root.render( - <> - - - - , - ); - - // Nothing should have rendered yet - expect(root).toMatchRenderedOutput(null); - - // Everything should render immediately in the next event - expect(Scheduler).toFlushExpired(['A', 'B', 'C']); - expect(root).toMatchRenderedOutput('ABC'); - }); - - it('layout updates flush synchronously in same event', () => { - const {useLayoutEffect} = React; - - function App() { - useLayoutEffect(() => { - Scheduler.unstable_yieldValue('Layout effect'); - }); - return ; - } - - const root = ReactNoop.createBlockingRoot(); - root.render(); - expect(root).toMatchRenderedOutput(null); - - expect(Scheduler).toFlushExpired(['Hi', 'Layout effect']); - expect(root).toMatchRenderedOutput('Hi'); - }); - - it('uses proper Suspense semantics, not legacy ones', async () => { - const root = ReactNoop.createBlockingRoot(); - root.render( - }> - - - - - - - - - - , - ); - - expect(Scheduler).toFlushExpired(['A', 'Suspend! [B]', 'C', 'Loading...']); - // In Legacy Mode, A and B would mount in a hidden primary tree. In Batched - // and Concurrent Mode, nothing in the primary tree should mount. But the - // fallback should mount immediately. - expect(root).toMatchRenderedOutput('Loading...'); - - await jest.advanceTimersByTime(1000); - expect(Scheduler).toHaveYielded(['Promise resolved [B]']); - expect(Scheduler).toFlushExpired(['A', 'B', 'C']); - expect(root).toMatchRenderedOutput( - <> - A - B - C - , - ); - }); - - it('flushSync does not flush batched work', () => { - const {useState, forwardRef, useImperativeHandle} = React; - const root = ReactNoop.createBlockingRoot(); - - const Foo = forwardRef(({label}, ref) => { - const [step, setStep] = useState(0); - useImperativeHandle(ref, () => ({setStep})); - return ; - }); - - const foo1 = React.createRef(null); - const foo2 = React.createRef(null); - root.render( - <> - - - , - ); - - // Mount - expect(Scheduler).toFlushExpired(['A0', 'B0']); - expect(root).toMatchRenderedOutput('A0B0'); - - // Schedule a batched update to the first sibling - ReactNoop.batchedUpdates(() => foo1.current.setStep(1)); - - // Before it flushes, update the second sibling inside flushSync - ReactNoop.batchedUpdates(() => - ReactNoop.flushSync(() => { - foo2.current.setStep(1); - }), - ); - - // Only the second update should have flushed synchronously - expect(Scheduler).toHaveYielded(['B1']); - expect(root).toMatchRenderedOutput('A0B1'); - - // Now flush the first update - expect(Scheduler).toFlushExpired(['A1']); - expect(root).toMatchRenderedOutput('A1B1'); - }); -}); diff --git a/packages/react-reconciler/src/__tests__/ReactIncrementalErrorHandling-test.internal.js b/packages/react-reconciler/src/__tests__/ReactIncrementalErrorHandling-test.internal.js index 613fe89d6327..a14c36bfce2b 100644 --- a/packages/react-reconciler/src/__tests__/ReactIncrementalErrorHandling-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactIncrementalErrorHandling-test.internal.js @@ -1870,10 +1870,6 @@ describe('ReactIncrementalErrorHandling', () => { const root = ReactNoop.createRoot(); root.render('Error when completing root'); expect(Scheduler).toFlushAndThrow('Error when completing root'); - - const blockingRoot = ReactNoop.createBlockingRoot(); - blockingRoot.render('Error when completing root'); - expect(Scheduler).toFlushAndThrow('Error when completing root'); }); } }); diff --git a/packages/react-reconciler/src/__tests__/ReactOffscreen-test.js b/packages/react-reconciler/src/__tests__/ReactOffscreen-test.js index b3f14e6ad1ef..2c6914fbfc0e 100644 --- a/packages/react-reconciler/src/__tests__/ReactOffscreen-test.js +++ b/packages/react-reconciler/src/__tests__/ReactOffscreen-test.js @@ -123,46 +123,4 @@ describe('ReactOffscreen', () => { , ); }); - - // @gate experimental - it('does not defer in blocking mode', async () => { - let setState; - function Foo() { - const [state, _setState] = useState('A'); - setState = _setState; - return ; - } - - const root = ReactNoop.createBlockingRoot(); - await ReactNoop.act(async () => { - root.render( - <> - - - - - , - ); - // Should not defer the hidden tree - expect(Scheduler).toFlushUntilNextPaint(['A', 'Outside']); - }); - expect(root).toMatchRenderedOutput( - <> - - - , - ); - - // Test that the children can be updated - await ReactNoop.act(async () => { - setState('B'); - }); - expect(Scheduler).toHaveYielded(['B']); - expect(root).toMatchRenderedOutput( - <> - - - , - ); - }); }); diff --git a/packages/react-reconciler/src/__tests__/ReactSuspenseFuzz-test.internal.js b/packages/react-reconciler/src/__tests__/ReactSuspenseFuzz-test.internal.js index eabcb41be0e6..c67edf8a1563 100644 --- a/packages/react-reconciler/src/__tests__/ReactSuspenseFuzz-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactSuspenseFuzz-test.internal.js @@ -170,13 +170,6 @@ describe('ReactSuspenseFuzz', () => { expect(legacyOutput).toEqual(expectedOutput); ReactNoop.renderLegacySyncRoot(null); - resetCache(); - const batchedBlockingRoot = ReactNoop.createBlockingRoot(); - batchedBlockingRoot.render(children); - resolveAllTasks(); - const batchedSyncOutput = batchedBlockingRoot.getChildrenAsJSX(); - expect(batchedSyncOutput).toEqual(expectedOutput); - resetCache(); const concurrentRoot = ReactNoop.createRoot(); concurrentRoot.render(children); diff --git a/packages/react/src/__tests__/ReactStrictMode-test.internal.js b/packages/react/src/__tests__/ReactStrictMode-test.internal.js index cb567340d398..20c83a46dfaa 100644 --- a/packages/react/src/__tests__/ReactStrictMode-test.internal.js +++ b/packages/react/src/__tests__/ReactStrictMode-test.internal.js @@ -66,23 +66,6 @@ describe('ReactStrictMode', () => { ]); }); - // @gate experimental - it('should support overriding default via createBlockingRoot option', () => { - act(() => { - const container = document.createElement('div'); - const root = ReactDOM.createBlockingRoot(container, { - unstable_strictModeLevel: 0, - }); - root.render(); - }); - - expect(log).toEqual([ - 'A: render', - 'A: useLayoutEffect mount', - 'A: useEffect mount', - ]); - }); - // @gate experimental it('should disable strict mode if level 0 is specified', () => { act(() => { diff --git a/packages/shared/ReactFeatureFlags.js b/packages/shared/ReactFeatureFlags.js index 201546e822b2..b6c7a2b93d0f 100644 --- a/packages/shared/ReactFeatureFlags.js +++ b/packages/shared/ReactFeatureFlags.js @@ -27,7 +27,7 @@ export const debugRenderPhaseSideEffectsForStrictMode = __DEV__; // this feature flag only impacts StrictEffectsMode. export const enableStrictEffects = false; -// If TRUE, trees rendered with createRoot (and createBlockingRoot) APIs will be StrictEffectsMode. +// If TRUE, trees rendered with createRoot will be StrictEffectsMode. // If FALSE, these trees will be StrictLegacyMode. export const createRootStrictEffectsByDefault = false;