GeezerVison is showing github.com — Don't clear other flags when adding Deletion · react/react@ff17fc1
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-reconciler/src/ReactChildFiber.new.js +7-2Lines changed: 7 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -13,7 +13,12 @@ import type {Fiber} from './ReactInternalTypes'; | 13 | 13 | import type {Lanes} from './ReactFiberLane.new'; | 14 | 14 |
| 15 | 15 | import getComponentName from 'shared/getComponentName'; | 16 | | -import {Deletion, ChildDeletion, Placement} from './ReactFiberFlags'; | | 16 | +import { | | 17 | + Deletion, | | 18 | + ChildDeletion, | | 19 | + Placement, | | 20 | + StaticMask, | | 21 | +} from './ReactFiberFlags'; | 17 | 22 | import { | 18 | 23 | getIteratorFn, | 19 | 24 | REACT_ELEMENT_TYPE, | @@ -275,7 +280,7 @@ function ChildReconciler(shouldTrackSideEffects) { | 275 | 280 | returnFiber.firstEffect = returnFiber.lastEffect = childToDelete; | 276 | 281 | } | 277 | 282 | childToDelete.nextEffect = null; | 278 | | - childToDelete.flags = Deletion; | | 283 | + childToDelete.flags = (childToDelete.flags & StaticMask) | Deletion; | 279 | 284 |
| 280 | 285 | let deletions = returnFiber.deletions; | 281 | 286 | if (deletions === null) { | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactChildFiber.old.js +7-2Lines changed: 7 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -13,7 +13,12 @@ import type {Fiber} from './ReactInternalTypes'; | 13 | 13 | import type {Lanes} from './ReactFiberLane.old'; | 14 | 14 |
| 15 | 15 | import getComponentName from 'shared/getComponentName'; | 16 | | -import {Deletion, ChildDeletion, Placement} from './ReactFiberFlags'; | | 16 | +import { | | 17 | + Deletion, | | 18 | + ChildDeletion, | | 19 | + Placement, | | 20 | + StaticMask, | | 21 | +} from './ReactFiberFlags'; | 17 | 22 | import { | 18 | 23 | getIteratorFn, | 19 | 24 | REACT_ELEMENT_TYPE, | @@ -275,7 +280,7 @@ function ChildReconciler(shouldTrackSideEffects) { | 275 | 280 | returnFiber.firstEffect = returnFiber.lastEffect = childToDelete; | 276 | 281 | } | 277 | 282 | childToDelete.nextEffect = null; | 278 | | - childToDelete.flags = Deletion; | | 283 | + childToDelete.flags = (childToDelete.flags & StaticMask) | Deletion; | 279 | 284 |
| 280 | 285 | let deletions = returnFiber.deletions; | 281 | 286 | if (deletions === null) { | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberBeginWork.new.js +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -2007,7 +2007,8 @@ function updateSuspensePrimaryChildren( | 2007 | 2007 | if (currentFallbackChildFragment !== null) { | 2008 | 2008 | // Delete the fallback child fragment | 2009 | 2009 | currentFallbackChildFragment.nextEffect = null; | 2010 | | - currentFallbackChildFragment.flags = Deletion; | | 2010 | + currentFallbackChildFragment.flags = | | 2011 | + (currentFallbackChildFragment.flags & StaticMask) | Deletion; | 2011 | 2012 | workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChildFragment; | 2012 | 2013 | let deletions = workInProgress.deletions; | 2013 | 2014 | if (deletions === null) { | @@ -2998,7 +2999,7 @@ function remountFiber( | 2998 | 2999 | returnFiber.firstEffect = returnFiber.lastEffect = current; | 2999 | 3000 | } | 3000 | 3001 | current.nextEffect = null; | 3001 | | - current.flags = Deletion; | | 3002 | + current.flags = (current.flags & StaticMask) | Deletion; | 3002 | 3003 |
| 3003 | 3004 | let deletions = returnFiber.deletions; | 3004 | 3005 | if (deletions === null) { | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberBeginWork.old.js +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -2007,7 +2007,8 @@ function updateSuspensePrimaryChildren( | 2007 | 2007 | if (currentFallbackChildFragment !== null) { | 2008 | 2008 | // Delete the fallback child fragment | 2009 | 2009 | currentFallbackChildFragment.nextEffect = null; | 2010 | | - currentFallbackChildFragment.flags = Deletion; | | 2010 | + currentFallbackChildFragment.flags = | | 2011 | + (currentFallbackChildFragment.flags & StaticMask) | Deletion; | 2011 | 2012 | workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChildFragment; | 2012 | 2013 | let deletions = workInProgress.deletions; | 2013 | 2014 | if (deletions === null) { | @@ -2998,7 +2999,7 @@ function remountFiber( | 2998 | 2999 | returnFiber.firstEffect = returnFiber.lastEffect = current; | 2999 | 3000 | } | 3000 | 3001 | current.nextEffect = null; | 3001 | | - current.flags = Deletion; | | 3002 | + current.flags = (current.flags & StaticMask) | Deletion; | 3002 | 3003 |
| 3003 | 3004 | let deletions = returnFiber.deletions; | 3004 | 3005 | if (deletions === null) { | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberClassComponent.old.js +6-39Lines changed: 6 additions & 39 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -12,14 +12,13 @@ import type {Lanes} from './ReactFiberLane.old'; | 12 | 12 | import type {UpdateQueue} from './ReactUpdateQueue.old'; | 13 | 13 |
| 14 | 14 | import * as React from 'react'; | 15 | | -import {Update, Snapshot, MountLayoutDev} from './ReactFiberFlags'; | | 15 | +import {Update, Snapshot} from './ReactFiberFlags'; | 16 | 16 | import { | 17 | 17 | debugRenderPhaseSideEffectsForStrictMode, | 18 | 18 | disableLegacyContext, | 19 | 19 | enableDebugTracing, | 20 | 20 | enableSchedulingProfiler, | 21 | 21 | warnAboutDeprecatedLifecycles, | 22 | | - enableDoubleInvokingEffects, | 23 | 22 | } from 'shared/ReactFeatureFlags'; | 24 | 23 | import ReactStrictModeWarnings from './ReactStrictModeWarnings.old'; | 25 | 24 | import {isMounted} from './ReactFiberTreeReflection'; | @@ -30,7 +29,7 @@ import invariant from 'shared/invariant'; | 30 | 29 | import {REACT_CONTEXT_TYPE, REACT_PROVIDER_TYPE} from 'shared/ReactSymbols'; | 31 | 30 |
| 32 | 31 | import {resolveDefaultProps} from './ReactFiberLazyComponent.old'; | 33 | | -import {DebugTracingMode, NoMode, StrictMode} from './ReactTypeOfMode'; | | 32 | +import {DebugTracingMode, StrictMode} from './ReactTypeOfMode'; | 34 | 33 |
| 35 | 34 | import { | 36 | 35 | enqueueUpdate, | @@ -891,15 +890,7 @@ function mountClassInstance( | 891 | 890 | } | 892 | 891 |
| 893 | 892 | if (typeof instance.componentDidMount === 'function') { | 894 | | - if ( | 895 | | - __DEV__ && | 896 | | - enableDoubleInvokingEffects && | 897 | | - (workInProgress.mode & StrictMode) !== NoMode | 898 | | - ) { | 899 | | - workInProgress.flags |= MountLayoutDev | Update; | 900 | | - } else { | 901 | | - workInProgress.flags |= Update; | 902 | | - } | | 893 | + workInProgress.flags |= Update; | 903 | 894 | } | 904 | 895 | } | 905 | 896 |
| @@ -969,15 +960,7 @@ function resumeMountClassInstance( | 969 | 960 | // If an update was already in progress, we should schedule an Update | 970 | 961 | // effect even though we're bailing out, so that cWU/cDU are called. | 971 | 962 | if (typeof instance.componentDidMount === 'function') { | 972 | | - if ( | 973 | | - __DEV__ && | 974 | | - enableDoubleInvokingEffects && | 975 | | - (workInProgress.mode & StrictMode) !== NoMode | 976 | | - ) { | 977 | | - workInProgress.flags |= MountLayoutDev | Update; | 978 | | - } else { | 979 | | - workInProgress.flags |= Update; | 980 | | - } | | 963 | + workInProgress.flags |= Update; | 981 | 964 | } | 982 | 965 | return false; | 983 | 966 | } | @@ -1020,29 +1003,13 @@ function resumeMountClassInstance( | 1020 | 1003 | } | 1021 | 1004 | } | 1022 | 1005 | if (typeof instance.componentDidMount === 'function') { | 1023 | | - if ( | 1024 | | - __DEV__ && | 1025 | | - enableDoubleInvokingEffects && | 1026 | | - (workInProgress.mode & StrictMode) !== NoMode | 1027 | | - ) { | 1028 | | - workInProgress.flags |= MountLayoutDev | Update; | 1029 | | - } else { | 1030 | | - workInProgress.flags |= Update; | 1031 | | - } | | 1006 | + workInProgress.flags |= Update; | 1032 | 1007 | } | 1033 | 1008 | } else { | 1034 | 1009 | // If an update was already in progress, we should schedule an Update | 1035 | 1010 | // effect even though we're bailing out, so that cWU/cDU are called. | 1036 | 1011 | if (typeof instance.componentDidMount === 'function') { | 1037 | | - if ( | 1038 | | - __DEV__ && | 1039 | | - enableDoubleInvokingEffects && | 1040 | | - (workInProgress.mode & StrictMode) !== NoMode | 1041 | | - ) { | 1042 | | - workInProgress.flags |= MountLayoutDev | Update; | 1043 | | - } else { | 1044 | | - workInProgress.flags |= Update; | 1045 | | - } | | 1012 | + workInProgress.flags |= Update; | 1046 | 1013 | } | 1047 | 1014 |
| 1048 | 1015 | // If shouldComponentUpdate returned false, we should still update the | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberCommitWork.old.js -115Lines changed: 0 additions & 115 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -35,7 +35,6 @@ import { | 35 | 35 | enableFundamentalAPI, | 36 | 36 | enableSuspenseCallback, | 37 | 37 | enableScopeAPI, | 38 | | - enableDoubleInvokingEffects, | 39 | 38 | } from 'shared/ReactFeatureFlags'; | 40 | 39 | import { | 41 | 40 | FunctionComponent, | @@ -1799,116 +1798,6 @@ function commitResetTextContent(current: Fiber) { | 1799 | 1798 | resetTextContent(current.stateNode); | 1800 | 1799 | } | 1801 | 1800 |
| 1802 | | -function invokeLayoutEffectMountInDEV(fiber: Fiber): void { | 1803 | | - if (__DEV__ && enableDoubleInvokingEffects) { | 1804 | | - switch (fiber.tag) { | 1805 | | - case FunctionComponent: | 1806 | | - case ForwardRef: | 1807 | | - case SimpleMemoComponent: { | 1808 | | - invokeGuardedCallback( | 1809 | | - null, | 1810 | | - commitHookEffectListMount, | 1811 | | - null, | 1812 | | - HookLayout | HookHasEffect, | 1813 | | - fiber, | 1814 | | - ); | 1815 | | - if (hasCaughtError()) { | 1816 | | - const mountError = clearCaughtError(); | 1817 | | - captureCommitPhaseError(fiber, mountError); | 1818 | | - } | 1819 | | - break; | 1820 | | - } | 1821 | | - case ClassComponent: { | 1822 | | - const instance = fiber.stateNode; | 1823 | | - invokeGuardedCallback(null, instance.componentDidMount, instance); | 1824 | | - if (hasCaughtError()) { | 1825 | | - const mountError = clearCaughtError(); | 1826 | | - captureCommitPhaseError(fiber, mountError); | 1827 | | - } | 1828 | | - break; | 1829 | | - } | 1830 | | - } | 1831 | | - } | 1832 | | -} | 1833 | | - | 1834 | | -function invokePassiveEffectMountInDEV(fiber: Fiber): void { | 1835 | | - if (__DEV__ && enableDoubleInvokingEffects) { | 1836 | | - switch (fiber.tag) { | 1837 | | - case FunctionComponent: | 1838 | | - case ForwardRef: | 1839 | | - case SimpleMemoComponent: { | 1840 | | - invokeGuardedCallback( | 1841 | | - null, | 1842 | | - commitHookEffectListMount, | 1843 | | - null, | 1844 | | - HookPassive | HookHasEffect, | 1845 | | - fiber, | 1846 | | - ); | 1847 | | - if (hasCaughtError()) { | 1848 | | - const mountError = clearCaughtError(); | 1849 | | - captureCommitPhaseError(fiber, mountError); | 1850 | | - } | 1851 | | - break; | 1852 | | - } | 1853 | | - } | 1854 | | - } | 1855 | | -} | 1856 | | - | 1857 | | -function invokeLayoutEffectUnmountInDEV(fiber: Fiber): void { | 1858 | | - if (__DEV__ && enableDoubleInvokingEffects) { | 1859 | | - switch (fiber.tag) { | 1860 | | - case FunctionComponent: | 1861 | | - case ForwardRef: | 1862 | | - case SimpleMemoComponent: { | 1863 | | - invokeGuardedCallback( | 1864 | | - null, | 1865 | | - commitHookEffectListUnmount, | 1866 | | - null, | 1867 | | - HookLayout | HookHasEffect, | 1868 | | - fiber, | 1869 | | - fiber.return, | 1870 | | - ); | 1871 | | - if (hasCaughtError()) { | 1872 | | - const unmountError = clearCaughtError(); | 1873 | | - captureCommitPhaseError(fiber, unmountError); | 1874 | | - } | 1875 | | - break; | 1876 | | - } | 1877 | | - case ClassComponent: { | 1878 | | - const instance = fiber.stateNode; | 1879 | | - if (typeof instance.componentWillUnmount === 'function') { | 1880 | | - safelyCallComponentWillUnmount(fiber, instance); | 1881 | | - } | 1882 | | - break; | 1883 | | - } | 1884 | | - } | 1885 | | - } | 1886 | | -} | 1887 | | - | 1888 | | -function invokePassiveEffectUnmountInDEV(fiber: Fiber): void { | 1889 | | - if (__DEV__ && enableDoubleInvokingEffects) { | 1890 | | - switch (fiber.tag) { | 1891 | | - case FunctionComponent: | 1892 | | - case ForwardRef: | 1893 | | - case SimpleMemoComponent: { | 1894 | | - invokeGuardedCallback( | 1895 | | - null, | 1896 | | - commitHookEffectListUnmount, | 1897 | | - null, | 1898 | | - HookPassive | HookHasEffect, | 1899 | | - fiber, | 1900 | | - fiber.return, | 1901 | | - ); | 1902 | | - if (hasCaughtError()) { | 1903 | | - const unmountError = clearCaughtError(); | 1904 | | - captureCommitPhaseError(fiber, unmountError); | 1905 | | - } | 1906 | | - break; | 1907 | | - } | 1908 | | - } | 1909 | | - } | 1910 | | -} | 1911 | | - | 1912 | 1801 | export { | 1913 | 1802 | commitBeforeMutationLifeCycles, | 1914 | 1803 | commitResetTextContent, | @@ -1918,8 +1807,4 @@ export { | 1918 | 1807 | commitLifeCycles, | 1919 | 1808 | commitAttachRef, | 1920 | 1809 | commitDetachRef, | 1921 | | - invokeLayoutEffectMountInDEV, | 1922 | | - invokeLayoutEffectUnmountInDEV, | 1923 | | - invokePassiveEffectMountInDEV, | 1924 | | - invokePassiveEffectUnmountInDEV, | 1925 | 1810 | }; |
|