GeezerVison is showing github.com — Remove decoupleUpdatePriorityFromScheduler · react/react@e89d74e
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/src/events/ReactDOMEventListener.js +6-20Lines changed: 6 additions & 20 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -40,7 +40,6 @@ import {getClosestInstanceFromNode} from '../client/ReactDOMComponentTree'; | 40 | 40 |
| 41 | 41 | import { | 42 | 42 | enableLegacyFBSupport, | 43 | | - decoupleUpdatePriorityFromScheduler, | 44 | 43 | enableNewReconciler, | 45 | 44 | } from 'shared/ReactFeatureFlags'; | 46 | 45 | import {dispatchEventForPluginEventSystem} from './DOMPluginEventSystem'; | @@ -177,25 +176,10 @@ function dispatchContinuousEvent( | 177 | 176 | container, | 178 | 177 | nativeEvent, | 179 | 178 | ) { | 180 | | - if (decoupleUpdatePriorityFromScheduler) { | 181 | | - const previousPriority = getCurrentUpdateLanePriority(); | 182 | | - try { | 183 | | - // TODO: Double wrapping is necessary while we decouple Scheduler priority. | 184 | | - setCurrentUpdateLanePriority(InputContinuousLanePriority); | 185 | | - runWithPriority( | 186 | | - UserBlockingPriority, | 187 | | - dispatchEvent.bind( | 188 | | - null, | 189 | | - domEventName, | 190 | | - eventSystemFlags, | 191 | | - container, | 192 | | - nativeEvent, | 193 | | - ), | 194 | | - ); | 195 | | - } finally { | 196 | | - setCurrentUpdateLanePriority(previousPriority); | 197 | | - } | 198 | | - } else { | | 179 | + const previousPriority = getCurrentUpdateLanePriority(); | | 180 | + try { | | 181 | + // TODO: Double wrapping is necessary while we decouple Scheduler priority. | | 182 | + setCurrentUpdateLanePriority(InputContinuousLanePriority); | 199 | 183 | runWithPriority( | 200 | 184 | UserBlockingPriority, | 201 | 185 | dispatchEvent.bind( | @@ -206,6 +190,8 @@ function dispatchContinuousEvent( | 206 | 190 | nativeEvent, | 207 | 191 | ), | 208 | 192 | ); | | 193 | + } finally { | | 194 | + setCurrentUpdateLanePriority(previousPriority); | 209 | 195 | } | 210 | 196 | } | 211 | 197 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberHooks.new.js +28-58Lines changed: 28 additions & 58 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -27,7 +27,6 @@ import { | 27 | 27 | enableSchedulingProfiler, | 28 | 28 | enableNewReconciler, | 29 | 29 | enableCache, | 30 | | - decoupleUpdatePriorityFromScheduler, | 31 | 30 | enableUseRefAccessWarning, | 32 | 31 | enableStrictEffects, | 33 | 32 | enableLazyContextPropagation, | @@ -1713,66 +1712,37 @@ function rerenderDeferredValue<T>(value: T): T { | 1713 | 1712 |
| 1714 | 1713 | function startTransition(setPending, callback) { | 1715 | 1714 | const priorityLevel = getCurrentPriorityLevel(); | 1716 | | - if (decoupleUpdatePriorityFromScheduler) { | 1717 | | - const previousLanePriority = getCurrentUpdateLanePriority(); | 1718 | | - setCurrentUpdateLanePriority( | 1719 | | - higherLanePriority(previousLanePriority, InputContinuousLanePriority), | 1720 | | - ); | | 1715 | + const previousLanePriority = getCurrentUpdateLanePriority(); | | 1716 | + setCurrentUpdateLanePriority( | | 1717 | + higherLanePriority(previousLanePriority, InputContinuousLanePriority), | | 1718 | + ); | 1721 | 1719 |
| 1722 | | - runWithPriority( | 1723 | | - priorityLevel < UserBlockingPriority | 1724 | | - ? UserBlockingPriority | 1725 | | - : priorityLevel, | 1726 | | - () => { | 1727 | | - setPending(true); | 1728 | | - }, | 1729 | | - ); | | 1720 | + runWithPriority( | | 1721 | + priorityLevel < UserBlockingPriority ? UserBlockingPriority : priorityLevel, | | 1722 | + () => { | | 1723 | + setPending(true); | | 1724 | + }, | | 1725 | + ); | 1730 | 1726 |
| 1731 | | - // TODO: Can remove this. Was only necessary because we used to give | 1732 | | - // different behavior to transitions without a config object. Now they are | 1733 | | - // all treated the same. | 1734 | | - setCurrentUpdateLanePriority(DefaultLanePriority); | | 1727 | + // TODO: Can remove this. Was only necessary because we used to give | | 1728 | + // different behavior to transitions without a config object. Now they are | | 1729 | + // all treated the same. | | 1730 | + setCurrentUpdateLanePriority(DefaultLanePriority); | 1735 | 1731 |
| 1736 | | - runWithPriority( | 1737 | | - priorityLevel > NormalPriority ? NormalPriority : priorityLevel, | 1738 | | - () => { | 1739 | | - const prevTransition = ReactCurrentBatchConfig.transition; | 1740 | | - ReactCurrentBatchConfig.transition = 1; | 1741 | | - try { | 1742 | | - setPending(false); | 1743 | | - callback(); | 1744 | | - } finally { | 1745 | | - if (decoupleUpdatePriorityFromScheduler) { | 1746 | | - setCurrentUpdateLanePriority(previousLanePriority); | 1747 | | - } | 1748 | | - ReactCurrentBatchConfig.transition = prevTransition; | 1749 | | - } | 1750 | | - }, | 1751 | | - ); | 1752 | | - } else { | 1753 | | - runWithPriority( | 1754 | | - priorityLevel < UserBlockingPriority | 1755 | | - ? UserBlockingPriority | 1756 | | - : priorityLevel, | 1757 | | - () => { | 1758 | | - setPending(true); | 1759 | | - }, | 1760 | | - ); | 1761 | | - | 1762 | | - runWithPriority( | 1763 | | - priorityLevel > NormalPriority ? NormalPriority : priorityLevel, | 1764 | | - () => { | 1765 | | - const prevTransition = ReactCurrentBatchConfig.transition; | 1766 | | - ReactCurrentBatchConfig.transition = 1; | 1767 | | - try { | 1768 | | - setPending(false); | 1769 | | - callback(); | 1770 | | - } finally { | 1771 | | - ReactCurrentBatchConfig.transition = prevTransition; | 1772 | | - } | 1773 | | - }, | 1774 | | - ); | 1775 | | - } | | 1732 | + runWithPriority( | | 1733 | + priorityLevel > NormalPriority ? NormalPriority : priorityLevel, | | 1734 | + () => { | | 1735 | + const prevTransition = ReactCurrentBatchConfig.transition; | | 1736 | + ReactCurrentBatchConfig.transition = 1; | | 1737 | + try { | | 1738 | + setPending(false); | | 1739 | + callback(); | | 1740 | + } finally { | | 1741 | + setCurrentUpdateLanePriority(previousLanePriority); | | 1742 | + ReactCurrentBatchConfig.transition = prevTransition; | | 1743 | + } | | 1744 | + }, | | 1745 | + ); | 1776 | 1746 | } | 1777 | 1747 |
| 1778 | 1748 | function mountTransition(): [(() => void) => void, boolean] { | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberHooks.old.js +28-58Lines changed: 28 additions & 58 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -27,7 +27,6 @@ import { | 27 | 27 | enableSchedulingProfiler, | 28 | 28 | enableNewReconciler, | 29 | 29 | enableCache, | 30 | | - decoupleUpdatePriorityFromScheduler, | 31 | 30 | enableUseRefAccessWarning, | 32 | 31 | enableStrictEffects, | 33 | 32 | enableLazyContextPropagation, | @@ -1713,66 +1712,37 @@ function rerenderDeferredValue<T>(value: T): T { | 1713 | 1712 |
| 1714 | 1713 | function startTransition(setPending, callback) { | 1715 | 1714 | const priorityLevel = getCurrentPriorityLevel(); | 1716 | | - if (decoupleUpdatePriorityFromScheduler) { | 1717 | | - const previousLanePriority = getCurrentUpdateLanePriority(); | 1718 | | - setCurrentUpdateLanePriority( | 1719 | | - higherLanePriority(previousLanePriority, InputContinuousLanePriority), | 1720 | | - ); | | 1715 | + const previousLanePriority = getCurrentUpdateLanePriority(); | | 1716 | + setCurrentUpdateLanePriority( | | 1717 | + higherLanePriority(previousLanePriority, InputContinuousLanePriority), | | 1718 | + ); | 1721 | 1719 |
| 1722 | | - runWithPriority( | 1723 | | - priorityLevel < UserBlockingPriority | 1724 | | - ? UserBlockingPriority | 1725 | | - : priorityLevel, | 1726 | | - () => { | 1727 | | - setPending(true); | 1728 | | - }, | 1729 | | - ); | | 1720 | + runWithPriority( | | 1721 | + priorityLevel < UserBlockingPriority ? UserBlockingPriority : priorityLevel, | | 1722 | + () => { | | 1723 | + setPending(true); | | 1724 | + }, | | 1725 | + ); | 1730 | 1726 |
| 1731 | | - // TODO: Can remove this. Was only necessary because we used to give | 1732 | | - // different behavior to transitions without a config object. Now they are | 1733 | | - // all treated the same. | 1734 | | - setCurrentUpdateLanePriority(DefaultLanePriority); | | 1727 | + // TODO: Can remove this. Was only necessary because we used to give | | 1728 | + // different behavior to transitions without a config object. Now they are | | 1729 | + // all treated the same. | | 1730 | + setCurrentUpdateLanePriority(DefaultLanePriority); | 1735 | 1731 |
| 1736 | | - runWithPriority( | 1737 | | - priorityLevel > NormalPriority ? NormalPriority : priorityLevel, | 1738 | | - () => { | 1739 | | - const prevTransition = ReactCurrentBatchConfig.transition; | 1740 | | - ReactCurrentBatchConfig.transition = 1; | 1741 | | - try { | 1742 | | - setPending(false); | 1743 | | - callback(); | 1744 | | - } finally { | 1745 | | - if (decoupleUpdatePriorityFromScheduler) { | 1746 | | - setCurrentUpdateLanePriority(previousLanePriority); | 1747 | | - } | 1748 | | - ReactCurrentBatchConfig.transition = prevTransition; | 1749 | | - } | 1750 | | - }, | 1751 | | - ); | 1752 | | - } else { | 1753 | | - runWithPriority( | 1754 | | - priorityLevel < UserBlockingPriority | 1755 | | - ? UserBlockingPriority | 1756 | | - : priorityLevel, | 1757 | | - () => { | 1758 | | - setPending(true); | 1759 | | - }, | 1760 | | - ); | 1761 | | - | 1762 | | - runWithPriority( | 1763 | | - priorityLevel > NormalPriority ? NormalPriority : priorityLevel, | 1764 | | - () => { | 1765 | | - const prevTransition = ReactCurrentBatchConfig.transition; | 1766 | | - ReactCurrentBatchConfig.transition = 1; | 1767 | | - try { | 1768 | | - setPending(false); | 1769 | | - callback(); | 1770 | | - } finally { | 1771 | | - ReactCurrentBatchConfig.transition = prevTransition; | 1772 | | - } | 1773 | | - }, | 1774 | | - ); | 1775 | | - } | | 1732 | + runWithPriority( | | 1733 | + priorityLevel > NormalPriority ? NormalPriority : priorityLevel, | | 1734 | + () => { | | 1735 | + const prevTransition = ReactCurrentBatchConfig.transition; | | 1736 | + ReactCurrentBatchConfig.transition = 1; | | 1737 | + try { | | 1738 | + setPending(false); | | 1739 | + callback(); | | 1740 | + } finally { | | 1741 | + setCurrentUpdateLanePriority(previousLanePriority); | | 1742 | + ReactCurrentBatchConfig.transition = prevTransition; | | 1743 | + } | | 1744 | + }, | | 1745 | + ); | 1776 | 1746 | } | 1777 | 1747 |
| 1778 | 1748 | function mountTransition(): [(() => void) => void, boolean] { | |
|