GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [Scheduler] Store Tasks on a Min Binary Heap (#16245) · react/react@d77c623

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages
    • react-dom/src/__tests__
      • ReactUpdates-test.js
    • scheduler/src
      • Scheduler.js
      • SchedulerMinHeap.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/react-dom/src/__tests__/ReactUpdates-test.js‎

Copy file name to clipboardExpand all lines: packages/react-dom/src/__tests__/ReactUpdates-test.js
+3-15Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,6 +1631,7 @@ describe('ReactUpdates', () => {
16311631
ReactDOM.render(<App />, container);
16321632
while (error === null) {
16331633
Scheduler.unstable_flushNumberOfYields(1);
1634+
Scheduler.unstable_clearYields();
16341635
}
16351636
expect(error).toContain('Warning: Maximum update depth exceeded.');
16361637
expect(stack).toContain('in NonTerminating');
@@ -1653,34 +1654,21 @@ describe('ReactUpdates', () => {
16531654
React.useEffect(() => {
16541655
if (step < LIMIT) {
16551656
setStep(x => x + 1);
1656-
Scheduler.unstable_yieldValue(step);
16571657
}
16581658
});
1659+
Scheduler.unstable_yieldValue(step);
16591660
return step;
16601661
}
16611662

16621663
const container = document.createElement('div');
16631664
act(() => {
16641665
ReactDOM.render(<Terminating />, container);
16651666
});
1666-
1667-
// Verify we can flush them asynchronously without warning
1668-
for (let i = 0; i < LIMIT * 2; i++) {
1669-
Scheduler.unstable_flushNumberOfYields(1);
1670-
}
16711667
expect(container.textContent).toBe('50');
1672-
1673-
// Verify restarting from 0 doesn't cross the limit
16741668
act(() => {
16751669
_setStep(0);
1676-
// flush once to update the dom
1677-
Scheduler.unstable_flushNumberOfYields(1);
1678-
expect(container.textContent).toBe('0');
1679-
for (let i = 0; i < LIMIT * 2; i++) {
1680-
Scheduler.unstable_flushNumberOfYields(1);
1681-
}
1682-
expect(container.textContent).toBe('50');
16831670
});
1671+
expect(container.textContent).toBe('50');
16841672
});
16851673

16861674
it('can have many updates inside useEffect without triggering a warning', () => {

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.