GeezerVison is showing github.com — Remove blocking mode and blocking root (#20888) · react/react@553440b
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/index.classic.fb.js -2Lines changed: 0 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -30,8 +30,6 @@ export { | 30 | 30 | unmountComponentAtNode, | 31 | 31 | createRoot, | 32 | 32 | createRoot as unstable_createRoot, | 33 | | - createBlockingRoot, | 34 | | - createBlockingRoot as unstable_createBlockingRoot, | 35 | 33 | unstable_flushControlled, | 36 | 34 | unstable_scheduleHydration, | 37 | 35 | unstable_runWithPriority, | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/index.experimental.js -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -20,7 +20,6 @@ export { | 20 | 20 | unmountComponentAtNode, | 21 | 21 | // exposeConcurrentModeAPIs | 22 | 22 | createRoot as unstable_createRoot, | 23 | | - createBlockingRoot as unstable_createBlockingRoot, | 24 | 23 | unstable_flushControlled, | 25 | 24 | unstable_scheduleHydration, | 26 | 25 | // DO NOT USE: Temporarily exposing this to migrate off of Scheduler.runWithPriority. | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/index.js -2Lines changed: 0 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -21,8 +21,6 @@ export { | 21 | 21 | unmountComponentAtNode, | 22 | 22 | createRoot, | 23 | 23 | createRoot as unstable_createRoot, | 24 | | - createBlockingRoot, | 25 | | - createBlockingRoot as unstable_createBlockingRoot, | 26 | 24 | unstable_flushControlled, | 27 | 25 | unstable_scheduleHydration, | 28 | 26 | unstable_runWithPriority, | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/index.modern.fb.js -2Lines changed: 0 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -15,8 +15,6 @@ export { | 15 | 15 | version, | 16 | 16 | createRoot, | 17 | 17 | createRoot as unstable_createRoot, | 18 | | - createBlockingRoot, | 19 | | - createBlockingRoot as unstable_createBlockingRoot, | 20 | 18 | unstable_flushControlled, | 21 | 19 | unstable_scheduleHydration, | 22 | 20 | unstable_runWithPriority, | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.js -27Lines changed: 0 additions & 27 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -593,33 +593,6 @@ describe('ReactDOMFiberAsync', () => { | 593 | 593 | expect(containerC.textContent).toEqual('Finished'); | 594 | 594 | }); | 595 | 595 |
| 596 | | - describe('createBlockingRoot', () => { | 597 | | - // @gate experimental | 598 | | - it('updates flush without yielding in the next event', () => { | 599 | | - const root = ReactDOM.unstable_createBlockingRoot(container); | 600 | | - | 601 | | - function Text(props) { | 602 | | - Scheduler.unstable_yieldValue(props.text); | 603 | | - return props.text; | 604 | | - } | 605 | | - | 606 | | - root.render( | 607 | | - <> | 608 | | - <Text text="A" /> | 609 | | - <Text text="B" /> | 610 | | - <Text text="C" /> | 611 | | - </>, | 612 | | - ); | 613 | | - | 614 | | - // Nothing should have rendered yet | 615 | | - expect(container.textContent).toEqual(''); | 616 | | - | 617 | | - // Everything should render immediately in the next event | 618 | | - expect(Scheduler).toFlushExpired(['A', 'B', 'C']); | 619 | | - expect(container.textContent).toEqual('ABC'); | 620 | | - }); | 621 | | - }); | 622 | | - | 623 | 596 | // @gate experimental | 624 | 597 | it('unmounted roots should never clear newer root content from a container', () => { | 625 | 598 | const ref = React.createRef(); | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -352,7 +352,7 @@ describe('ReactDOMServerPartialHydration', () => { | 352 | 352 | }).toErrorDev( | 353 | 353 | 'Warning: Cannot hydrate Suspense in legacy mode. Switch from ' + | 354 | 354 | 'ReactDOM.hydrate(element, container) to ' + | 355 | | - 'ReactDOM.createBlockingRoot(container, { hydrate: true })' + | | 355 | + 'ReactDOM.createRoot(container, { hydrate: true })' + | 356 | 356 | '.render(element) or remove the Suspense components from the server ' + | 357 | 357 | 'rendered components.' + | 358 | 358 | '\n in Suspense (at **)' + | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/src/__tests__/ReactDOMServerSuspense-test.internal.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -127,7 +127,7 @@ describe('ReactDOMServerSuspense', () => { | 127 | 127 | expect(divB.textContent).toBe('B'); | 128 | 128 |
| 129 | 129 | act(() => { | 130 | | - const root = ReactDOM.createBlockingRoot(parent, {hydrate: true}); | | 130 | + const root = ReactDOM.createRoot(parent, {hydrate: true}); | 131 | 131 | root.render(example); | 132 | 132 | }); | 133 | 133 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/src/__tests__/ReactTestUtilsAct-test.js +6-52Lines changed: 6 additions & 52 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -72,33 +72,6 @@ describe('ReactTestUtils.act()', () => { | 72 | 72 |
| 73 | 73 | runActTests('legacy mode', renderLegacy, unmountLegacy, rerenderLegacy); | 74 | 74 |
| 75 | | - // and then in blocking mode | 76 | | - if (__EXPERIMENTAL__) { | 77 | | - let blockingRoot = null; | 78 | | - const renderBatched = (el, dom) => { | 79 | | - blockingRoot = ReactDOM.unstable_createBlockingRoot(dom); | 80 | | - blockingRoot.render(el); | 81 | | - }; | 82 | | - | 83 | | - const unmountBatched = dom => { | 84 | | - if (blockingRoot !== null) { | 85 | | - blockingRoot.unmount(); | 86 | | - blockingRoot = null; | 87 | | - } | 88 | | - }; | 89 | | - | 90 | | - const rerenderBatched = el => { | 91 | | - blockingRoot.render(el); | 92 | | - }; | 93 | | - | 94 | | - runActTests( | 95 | | - 'blocking mode', | 96 | | - renderBatched, | 97 | | - unmountBatched, | 98 | | - rerenderBatched, | 99 | | - ); | 100 | | - } | 101 | | - | 102 | 75 | describe('unacted effects', () => { | 103 | 76 | function App() { | 104 | 77 | React.useEffect(() => {}, []); | @@ -124,19 +97,6 @@ describe('ReactTestUtils.act()', () => { | 124 | 97 | ]); | 125 | 98 | }); | 126 | 99 |
| 127 | | - // @gate experimental | 128 | | - it('warns in blocking mode', () => { | 129 | | - expect(() => { | 130 | | - const root = ReactDOM.unstable_createBlockingRoot( | 131 | | - document.createElement('div'), | 132 | | - ); | 133 | | - root.render(<App />); | 134 | | - Scheduler.unstable_flushAll(); | 135 | | - }).toErrorDev([ | 136 | | - 'An update to App ran an effect, but was not wrapped in act(...)', | 137 | | - ]); | 138 | | - }); | 139 | | - | 140 | 100 | // @gate experimental | 141 | 101 | it('warns in concurrent mode', () => { | 142 | 102 | expect(() => { | @@ -731,14 +691,10 @@ function runActTests(label, render, unmount, rerender) { | 731 | 691 |
| 732 | 692 | it('triggers fallbacks if available', async () => { | 733 | 693 | if (label !== 'legacy mode') { | 734 | | - // FIXME: Support for Blocking* and Concurrent Mode were | 735 | | - // intentionally removed from the public version of `act`. It will | 736 | | - // be added back in a future major version, before Blocking and and | 737 | | - // Concurrent Mode are officially released. Consider disabling all | 738 | | - // non-Legacy tests in this suite until then. | 739 | | - // | 740 | | - // *Blocking Mode actually does happen to work, though | 741 | | - // not "officially" since it's an unreleased feature. | | 694 | + // FIXME: Support for Concurrent Root intentionally removed | | 695 | + // from the public version of `act`. It will be added back in | | 696 | + // a future major version, Concurrent Root officially released. | | 697 | + // Consider skipping all non-Legacy tests in this suite until then. | 742 | 698 | return; | 743 | 699 | } | 744 | 700 |
| @@ -794,10 +750,8 @@ function runActTests(label, render, unmount, rerender) { | 794 | 750 | // In Concurrent Mode, refresh transitions delay indefinitely. | 795 | 751 | expect(document.querySelector('[data-test-id=spinner]')).toBeNull(); | 796 | 752 | } else { | 797 | | - // In Legacy Mode and Blocking Mode, all fallbacks are forced to | 798 | | - // display, even during a refresh transition. | 799 | | - // TODO: Consider delaying indefinitely in Blocking Mode, to match | 800 | | - // Concurrent Mode semantics. | | 753 | + // In Legacy Mode, all fallbacks are forced to display, | | 754 | + // even during a refresh transition. | 801 | 755 | expect( | 802 | 756 | document.querySelector('[data-test-id=spinner]'), | 803 | 757 | ).not.toBeNull(); | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/src/__tests__/ReactUnmockedSchedulerWarning-test.js -19Lines changed: 0 additions & 19 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -43,22 +43,3 @@ it('should warn when rendering in concurrent mode', () => { | 43 | 43 | ReactDOM.unstable_createRoot(document.createElement('div')).render(<App />); | 44 | 44 | }).toErrorDev([]); | 45 | 45 | }); | 46 | | - | 47 | | -// @gate experimental | 48 | | -it('should warn when rendering in blocking mode', () => { | 49 | | - expect(() => { | 50 | | - ReactDOM.unstable_createBlockingRoot(document.createElement('div')).render( | 51 | | - <App />, | 52 | | - ); | 53 | | - }).toErrorDev( | 54 | | - 'In Concurrent or Sync modes, the "scheduler" module needs to be mocked ' + | 55 | | - 'to guarantee consistent behaviour across tests and browsers.', | 56 | | - {withoutStack: true}, | 57 | | - ); | 58 | | - // does not warn twice | 59 | | - expect(() => { | 60 | | - ReactDOM.unstable_createBlockingRoot(document.createElement('div')).render( | 61 | | - <App />, | 62 | | - ); | 63 | | - }).toErrorDev([]); | 64 | | -}); |
Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/src/client/ReactDOM.js +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -18,7 +18,7 @@ import { | 18 | 18 | unstable_renderSubtreeIntoContainer, | 19 | 19 | unmountComponentAtNode, | 20 | 20 | } from './ReactDOMLegacy'; | 21 | | -import {createRoot, createBlockingRoot, isValidContainer} from './ReactDOMRoot'; | | 21 | +import {createRoot, isValidContainer} from './ReactDOMRoot'; | 22 | 22 | import {createEventHandle} from './ReactDOMEventHandle'; | 23 | 23 |
| 24 | 24 | import { | @@ -201,7 +201,6 @@ export { | 201 | 201 | unmountComponentAtNode, | 202 | 202 | // exposeConcurrentModeAPIs | 203 | 203 | createRoot, | 204 | | - createBlockingRoot, | 205 | 204 | flushControlled as unstable_flushControlled, | 206 | 205 | scheduleHydration as unstable_scheduleHydration, | 207 | 206 | // Disabled behind disableUnstableRenderSubtreeIntoContainer | |
|