GeezerVison is showing github.com — [DOM] Shrink ReactDOMCurrentDispatcher method names (#28770) · react/react@97c90ed
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-bindings/src/client/ReactFiberConfigDOM.js +17-17Lines changed: 17 additions & 17 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1925,21 +1925,21 @@ function getDocumentFromRoot(root: HoistableRoot): Document { | 1925 | 1925 | const previousDispatcher = | 1926 | 1926 | ReactDOMSharedInternals.d; /* ReactDOMCurrentDispatcher */ | 1927 | 1927 | ReactDOMSharedInternals.d /* ReactDOMCurrentDispatcher */ = { | 1928 | | - flushSyncWork: disableLegacyMode | | 1928 | + f /* flushSyncWork */: disableLegacyMode | 1929 | 1929 | ? flushSyncWork | 1930 | | - : previousDispatcher.flushSyncWork, | 1931 | | - prefetchDNS, | 1932 | | - preconnect, | 1933 | | - preload, | 1934 | | - preloadModule, | 1935 | | - preinitStyle, | 1936 | | - preinitScript, | 1937 | | - preinitModuleScript, | | 1930 | + : previousDispatcher.f /* flushSyncWork */, | | 1931 | + D /* prefetchDNS */: prefetchDNS, | | 1932 | + C /* preconnect */: preconnect, | | 1933 | + L /* preload */: preload, | | 1934 | + m /* preloadModule */: preloadModule, | | 1935 | + X /* preinitScript */: preinitScript, | | 1936 | + S /* preinitStyle */: preinitStyle, | | 1937 | + M /* preinitModuleScript */: preinitModuleScript, | 1938 | 1938 | }; | 1939 | 1939 |
| 1940 | 1940 | function flushSyncWork() { | 1941 | 1941 | if (disableLegacyMode) { | 1942 | | - const previousWasRendering = previousDispatcher.flushSyncWork(); | | 1942 | + const previousWasRendering = previousDispatcher.f(); /* flushSyncWork */ | 1943 | 1943 | const wasRendering = flushSyncWorkOnAllRoots(); | 1944 | 1944 | // Since multiple dispatchers can flush sync work during a single flushSync call | 1945 | 1945 | // we need to return true if any of them were rendering. | @@ -1990,17 +1990,17 @@ function preconnectAs( | 1990 | 1990 | } | 1991 | 1991 |
| 1992 | 1992 | function prefetchDNS(href: string) { | 1993 | | - previousDispatcher.prefetchDNS(href); | | 1993 | + previousDispatcher.D(/* prefetchDNS */ href); | 1994 | 1994 | preconnectAs('dns-prefetch', href, null); | 1995 | 1995 | } | 1996 | 1996 |
| 1997 | 1997 | function preconnect(href: string, crossOrigin?: ?CrossOriginEnum) { | 1998 | | - previousDispatcher.preconnect(href, crossOrigin); | | 1998 | + previousDispatcher.C(/* preconnect */ href, crossOrigin); | 1999 | 1999 | preconnectAs('preconnect', href, crossOrigin); | 2000 | 2000 | } | 2001 | 2001 |
| 2002 | 2002 | function preload(href: string, as: string, options?: ?PreloadImplOptions) { | 2003 | | - previousDispatcher.preload(href, as, options); | | 2003 | + previousDispatcher.L(/* preload */ href, as, options); | 2004 | 2004 | const ownerDocument = getGlobalDocument(); | 2005 | 2005 | if (ownerDocument && href && as) { | 2006 | 2006 | let preloadSelector = `link[rel="preload"][as="${escapeSelectorAttributeValueInsideDoubleQuotes( | @@ -2078,7 +2078,7 @@ function preload(href: string, as: string, options?: ?PreloadImplOptions) { | 2078 | 2078 | } | 2079 | 2079 |
| 2080 | 2080 | function preloadModule(href: string, options?: ?PreloadModuleImplOptions) { | 2081 | | - previousDispatcher.preloadModule(href, options); | | 2081 | + previousDispatcher.m(/* preloadModule */ href, options); | 2082 | 2082 | const ownerDocument = getGlobalDocument(); | 2083 | 2083 | if (ownerDocument && href) { | 2084 | 2084 | const as = | @@ -2139,7 +2139,7 @@ function preinitStyle( | 2139 | 2139 | precedence: ?string, | 2140 | 2140 | options?: ?PreinitStyleOptions, | 2141 | 2141 | ) { | 2142 | | - previousDispatcher.preinitStyle(href, precedence, options); | | 2142 | + previousDispatcher.S(/* preinitStyle */ href, precedence, options); | 2143 | 2143 |
| 2144 | 2144 | const ownerDocument = getGlobalDocument(); | 2145 | 2145 | if (ownerDocument && href) { | @@ -2213,7 +2213,7 @@ function preinitStyle( | 2213 | 2213 | } | 2214 | 2214 |
| 2215 | 2215 | function preinitScript(src: string, options?: ?PreinitScriptOptions) { | 2216 | | - previousDispatcher.preinitScript(src, options); | | 2216 | + previousDispatcher.X(/* preinitScript */ src, options); | 2217 | 2217 |
| 2218 | 2218 | const ownerDocument = getGlobalDocument(); | 2219 | 2219 | if (ownerDocument && src) { | @@ -2269,7 +2269,7 @@ function preinitModuleScript( | 2269 | 2269 | src: string, | 2270 | 2270 | options?: ?PreinitModuleScriptOptions, | 2271 | 2271 | ) { | 2272 | | - previousDispatcher.preinitModuleScript(src, options); | | 2272 | + previousDispatcher.M(/* preinitModuleScript */ src, options); | 2273 | 2273 |
| 2274 | 2274 | const ownerDocument = getGlobalDocument(); | 2275 | 2275 | if (ownerDocument && src) { | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-dom-bindings/src/server/ReactDOMFlightServerHostDispatcher.js +15-15Lines changed: 15 additions & 15 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -27,14 +27,14 @@ import ReactDOMSharedInternals from 'shared/ReactDOMSharedInternals'; | 27 | 27 | const previousDispatcher = | 28 | 28 | ReactDOMSharedInternals.d; /* ReactDOMCurrentDispatcher */ | 29 | 29 | ReactDOMSharedInternals.d /* ReactDOMCurrentDispatcher */ = { | 30 | | - flushSyncWork: previousDispatcher.flushSyncWork, | 31 | | - prefetchDNS, | 32 | | - preconnect, | 33 | | - preload, | 34 | | - preloadModule, | 35 | | - preinitStyle, | 36 | | - preinitScript, | 37 | | - preinitModuleScript, | | 30 | + f /* flushSyncWork */: previousDispatcher.f /* flushSyncWork */, | | 31 | + D /* prefetchDNS */: prefetchDNS, | | 32 | + C /* preconnect */: preconnect, | | 33 | + L /* preload */: preload, | | 34 | + m /* preloadModule */: preloadModule, | | 35 | + X /* preinitScript */: preinitScript, | | 36 | + S /* preinitStyle */: preinitStyle, | | 37 | + M /* preinitModuleScript */: preinitModuleScript, | 38 | 38 | }; | 39 | 39 |
| 40 | 40 | function prefetchDNS(href: string) { | @@ -50,7 +50,7 @@ function prefetchDNS(href: string) { | 50 | 50 | hints.add(key); | 51 | 51 | emitHint(request, 'D', href); | 52 | 52 | } else { | 53 | | - previousDispatcher.prefetchDNS(href); | | 53 | + previousDispatcher.D(/* prefetchDNS */ href); | 54 | 54 | } | 55 | 55 | } | 56 | 56 | } | @@ -73,7 +73,7 @@ function preconnect(href: string, crossOrigin?: ?CrossOriginEnum) { | 73 | 73 | emitHint(request, 'C', href); | 74 | 74 | } | 75 | 75 | } else { | 76 | | - previousDispatcher.preconnect(href, crossOrigin); | | 76 | + previousDispatcher.C(/* preconnect */ href, crossOrigin); | 77 | 77 | } | 78 | 78 | } | 79 | 79 | } | @@ -106,7 +106,7 @@ function preload(href: string, as: string, options?: ?PreloadImplOptions) { | 106 | 106 | emitHint(request, 'L', [href, as]); | 107 | 107 | } | 108 | 108 | } else { | 109 | | - previousDispatcher.preload(href, as, options); | | 109 | + previousDispatcher.L(/* preload */ href, as, options); | 110 | 110 | } | 111 | 111 | } | 112 | 112 | } | @@ -130,7 +130,7 @@ function preloadModule(href: string, options?: ?PreloadModuleImplOptions) { | 130 | 130 | return emitHint(request, 'm', href); | 131 | 131 | } | 132 | 132 | } else { | 133 | | - previousDispatcher.preloadModule(href, options); | | 133 | + previousDispatcher.m(/* preloadModule */ href, options); | 134 | 134 | } | 135 | 135 | } | 136 | 136 | } | @@ -164,7 +164,7 @@ function preinitStyle( | 164 | 164 | return emitHint(request, 'S', href); | 165 | 165 | } | 166 | 166 | } else { | 167 | | - previousDispatcher.preinitStyle(href, precedence, options); | | 167 | + previousDispatcher.S(/* preinitStyle */ href, precedence, options); | 168 | 168 | } | 169 | 169 | } | 170 | 170 | } | @@ -188,7 +188,7 @@ function preinitScript(src: string, options?: ?PreinitScriptOptions) { | 188 | 188 | return emitHint(request, 'X', src); | 189 | 189 | } | 190 | 190 | } else { | 191 | | - previousDispatcher.preinitScript(src, options); | | 191 | + previousDispatcher.X(/* preinitScript */ src, options); | 192 | 192 | } | 193 | 193 | } | 194 | 194 | } | @@ -215,7 +215,7 @@ function preinitModuleScript( | 215 | 215 | return emitHint(request, 'M', src); | 216 | 216 | } | 217 | 217 | } else { | 218 | | - previousDispatcher.preinitModuleScript(src, options); | | 218 | + previousDispatcher.M(/* preinitModuleScript */ src, options); | 219 | 219 | } | 220 | 220 | } | 221 | 221 | } | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js +15-15Lines changed: 15 additions & 15 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -87,14 +87,14 @@ import ReactDOMSharedInternals from 'shared/ReactDOMSharedInternals'; | 87 | 87 | const previousDispatcher = | 88 | 88 | ReactDOMSharedInternals.d; /* ReactDOMCurrentDispatcher */ | 89 | 89 | ReactDOMSharedInternals.d /* ReactDOMCurrentDispatcher */ = { | 90 | | - flushSyncWork: previousDispatcher.flushSyncWork, | 91 | | - prefetchDNS, | 92 | | - preconnect, | 93 | | - preload, | 94 | | - preloadModule, | 95 | | - preinitScript, | 96 | | - preinitStyle, | 97 | | - preinitModuleScript, | | 90 | + f /* flushSyncWork */: previousDispatcher.f /* flushSyncWork */, | | 91 | + D /* prefetchDNS */: prefetchDNS, | | 92 | + C /* preconnect */: preconnect, | | 93 | + L /* preload */: preload, | | 94 | + m /* preloadModule */: preloadModule, | | 95 | + X /* preinitScript */: preinitScript, | | 96 | + S /* preinitStyle */: preinitStyle, | | 97 | + M /* preinitModuleScript */: preinitModuleScript, | 98 | 98 | }; | 99 | 99 |
| 100 | 100 | // We make every property of the descriptor optional because it is not a contract that | @@ -5266,7 +5266,7 @@ function prefetchDNS(href: string) { | 5266 | 5266 | // the resources for this call in either case we opt to do nothing. We can consider making this a warning | 5267 | 5267 | // but there may be times where calling a function outside of render is intentional (i.e. to warm up data | 5268 | 5268 | // fetching) and we don't want to warn in those cases. | 5269 | | - previousDispatcher.prefetchDNS(href); | | 5269 | + previousDispatcher.D(/* prefetchDNS */ href); | 5270 | 5270 | return; | 5271 | 5271 | } | 5272 | 5272 | const resumableState = getResumableState(request); | @@ -5319,7 +5319,7 @@ function preconnect(href: string, crossOrigin: ?CrossOriginEnum) { | 5319 | 5319 | // the resources for this call in either case we opt to do nothing. We can consider making this a warning | 5320 | 5320 | // but there may be times where calling a function outside of render is intentional (i.e. to warm up data | 5321 | 5321 | // fetching) and we don't want to warn in those cases. | 5322 | | - previousDispatcher.preconnect(href, crossOrigin); | | 5322 | + previousDispatcher.C(/* preconnect */ href, crossOrigin); | 5323 | 5323 | return; | 5324 | 5324 | } | 5325 | 5325 | const resumableState = getResumableState(request); | @@ -5380,7 +5380,7 @@ function preload(href: string, as: string, options?: ?PreloadImplOptions) { | 5380 | 5380 | // the resources for this call in either case we opt to do nothing. We can consider making this a warning | 5381 | 5381 | // but there may be times where calling a function outside of render is intentional (i.e. to warm up data | 5382 | 5382 | // fetching) and we don't want to warn in those cases. | 5383 | | - previousDispatcher.preload(href, as, options); | | 5383 | + previousDispatcher.L(/* preload */ href, as, options); | 5384 | 5384 | return; | 5385 | 5385 | } | 5386 | 5386 | const resumableState = getResumableState(request); | @@ -5581,7 +5581,7 @@ function preloadModule( | 5581 | 5581 | // the resources for this call in either case we opt to do nothing. We can consider making this a warning | 5582 | 5582 | // but there may be times where calling a function outside of render is intentional (i.e. to warm up data | 5583 | 5583 | // fetching) and we don't want to warn in those cases. | 5584 | | - previousDispatcher.preloadModule(href, options); | | 5584 | + previousDispatcher.m(/* preloadModule */ href, options); | 5585 | 5585 | return; | 5586 | 5586 | } | 5587 | 5587 | const resumableState = getResumableState(request); | @@ -5655,7 +5655,7 @@ function preinitStyle( | 5655 | 5655 | // the resources for this call in either case we opt to do nothing. We can consider making this a warning | 5656 | 5656 | // but there may be times where calling a function outside of render is intentional (i.e. to warm up data | 5657 | 5657 | // fetching) and we don't want to warn in those cases. | 5658 | | - previousDispatcher.preinitStyle(href, precedence, options); | | 5658 | + previousDispatcher.S(/* preinitStyle */ href, precedence, options); | 5659 | 5659 | return; | 5660 | 5660 | } | 5661 | 5661 | const resumableState = getResumableState(request); | @@ -5740,7 +5740,7 @@ function preinitScript(src: string, options?: ?PreinitScriptOptions): void { | 5740 | 5740 | // the resources for this call in either case we opt to do nothing. We can consider making this a warning | 5741 | 5741 | // but there may be times where calling a function outside of render is intentional (i.e. to warm up data | 5742 | 5742 | // fetching) and we don't want to warn in those cases. | 5743 | | - previousDispatcher.preinitScript(src, options); | | 5743 | + previousDispatcher.X(/* preinitScript */ src, options); | 5744 | 5744 | return; | 5745 | 5745 | } | 5746 | 5746 | const resumableState = getResumableState(request); | @@ -5803,7 +5803,7 @@ function preinitModuleScript( | 5803 | 5803 | // the resources for this call in either case we opt to do nothing. We can consider making this a warning | 5804 | 5804 | // but there may be times where calling a function outside of render is intentional (i.e. to warm up data | 5805 | 5805 | // fetching) and we don't want to warn in those cases. | 5806 | | - previousDispatcher.preinitModuleScript(src, options); | | 5806 | + previousDispatcher.M(/* preinitModuleScript */ src, options); | 5807 | 5807 | return; | 5808 | 5808 | } | 5809 | 5809 | const resumableState = getResumableState(request); | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-dom-bindings/src/shared/ReactFlightClientConfigDOM.js +20-20Lines changed: 20 additions & 20 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -25,18 +25,18 @@ export function dispatchHint<Code: HintCode>( | 25 | 25 | case 'D': { | 26 | 26 | const refined = refineModel(code, model); | 27 | 27 | const href = refined; | 28 | | - dispatcher.prefetchDNS(href); | | 28 | + dispatcher.D(/* prefetchDNS */ href); | 29 | 29 | return; | 30 | 30 | } | 31 | 31 | case 'C': { | 32 | 32 | const refined = refineModel(code, model); | 33 | 33 | if (typeof refined === 'string') { | 34 | 34 | const href = refined; | 35 | | - dispatcher.preconnect(href); | | 35 | + dispatcher.C(/* preconnect */ href); | 36 | 36 | } else { | 37 | 37 | const href = refined[0]; | 38 | 38 | const crossOrigin = refined[1]; | 39 | | - dispatcher.preconnect(href, crossOrigin); | | 39 | + dispatcher.C(/* preconnect */ href, crossOrigin); | 40 | 40 | } | 41 | 41 | return; | 42 | 42 | } | @@ -46,58 +46,58 @@ export function dispatchHint<Code: HintCode>( | 46 | 46 | const as = refined[1]; | 47 | 47 | if (refined.length === 3) { | 48 | 48 | const options = refined[2]; | 49 | | - dispatcher.preload(href, as, options); | | 49 | + dispatcher.L(/* preload */ href, as, options); | 50 | 50 | } else { | 51 | | - dispatcher.preload(href, as); | | 51 | + dispatcher.L(/* preload */ href, as); | 52 | 52 | } | 53 | 53 | return; | 54 | 54 | } | 55 | 55 | case 'm': { | 56 | 56 | const refined = refineModel(code, model); | 57 | 57 | if (typeof refined === 'string') { | 58 | 58 | const href = refined; | 59 | | - dispatcher.preloadModule(href); | | 59 | + dispatcher.m(/* preloadModule */ href); | 60 | 60 | } else { | 61 | 61 | const href = refined[0]; | 62 | 62 | const options = refined[1]; | 63 | | - dispatcher.preloadModule(href, options); | | 63 | + dispatcher.m(/* preloadModule */ href, options); | 64 | 64 | } | 65 | 65 | return; | 66 | 66 | } | 67 | | - case 'S': { | | 67 | + case 'X': { | 68 | 68 | const refined = refineModel(code, model); | 69 | 69 | if (typeof refined === 'string') { | 70 | 70 | const href = refined; | 71 | | - dispatcher.preinitStyle(href); | | 71 | + dispatcher.X(/* preinitScript */ href); | 72 | 72 | } else { | 73 | 73 | const href = refined[0]; | 74 | | - const precedence = refined[1] === 0 ? undefined : refined[1]; | 75 | | - const options = refined.length === 3 ? refined[2] : undefined; | 76 | | - dispatcher.preinitStyle(href, precedence, options); | | 74 | + const options = refined[1]; | | 75 | + dispatcher.X(/* preinitScript */ href, options); | 77 | 76 | } | 78 | 77 | return; | 79 | 78 | } | 80 | | - case 'X': { | | 79 | + case 'S': { | 81 | 80 | const refined = refineModel(code, model); | 82 | 81 | if (typeof refined === 'string') { | 83 | 82 | const href = refined; | 84 | | - dispatcher.preinitScript(href); | | 83 | + dispatcher.S(/* preinitStyle */ href); | 85 | 84 | } else { | 86 | 85 | const href = refined[0]; | 87 | | - const options = refined[1]; | 88 | | - dispatcher.preinitScript(href, options); | | 86 | + const precedence = refined[1] === 0 ? undefined : refined[1]; | | 87 | + const options = refined.length === 3 ? refined[2] : undefined; | | 88 | + dispatcher.S(/* preinitStyle */ href, precedence, options); | 89 | 89 | } | 90 | 90 | return; | 91 | 91 | } | 92 | 92 | case 'M': { | 93 | 93 | const refined = refineModel(code, model); | 94 | 94 | if (typeof refined === 'string') { | 95 | 95 | const href = refined; | 96 | | - dispatcher.preinitModuleScript(href); | | 96 | + dispatcher.M(/* preinitModuleScript */ href); | 97 | 97 | } else { | 98 | 98 | const href = refined[0]; | 99 | 99 | const options = refined[1]; | 100 | | - dispatcher.preinitModuleScript(href, options); | | 100 | + dispatcher.M(/* preinitModuleScript */ href, options); | 101 | 101 | } | 102 | 102 | return; | 103 | 103 | } | @@ -116,7 +116,7 @@ export function preinitModuleForSSR( | 116 | 116 | crossOrigin: ?string, | 117 | 117 | ) { | 118 | 118 | ReactDOMSharedInternals.d /* ReactDOMCurrentDispatcher */ | 119 | | - .preinitModuleScript(href, { | | 119 | + .M(/* preinitModuleScript */ href, { | 120 | 120 | crossOrigin: getCrossOriginString(crossOrigin), | 121 | 121 | nonce, | 122 | 122 | }); | @@ -128,7 +128,7 @@ export function preinitScriptForSSR( | 128 | 128 | crossOrigin: ?string, | 129 | 129 | ) { | 130 | 130 | ReactDOMSharedInternals.d /* ReactDOMCurrentDispatcher */ | 131 | | - .preinitScript(href, { | | 131 | + .X(/* preinitScript */ href, { | 132 | 132 | crossOrigin: getCrossOriginString(crossOrigin), | 133 | 133 | nonce, | 134 | 134 | }); | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/src/ReactDOMSharedInternals.js +8-8Lines changed: 8 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -30,14 +30,14 @@ export type ReactDOMInternalsDev = ReactDOMInternals & { | 30 | 30 | function noop() {} | 31 | 31 |
| 32 | 32 | const DefaultDispatcher: HostDispatcher = { | 33 | | - flushSyncWork: noop, | 34 | | - prefetchDNS: noop, | 35 | | - preconnect: noop, | 36 | | - preload: noop, | 37 | | - preloadModule: noop, | 38 | | - preinitScript: noop, | 39 | | - preinitStyle: noop, | 40 | | - preinitModuleScript: noop, | | 33 | + f /* flushSyncWork */: noop, | | 34 | + D /* prefetchDNS */: noop, | | 35 | + C /* preconnect */: noop, | | 36 | + L /* preload */: noop, | | 37 | + m /* preloadModule */: noop, | | 38 | + X /* preinitScript */: noop, | | 39 | + S /* preinitStyle */: noop, | | 40 | + M /* preinitModuleScript */: noop, | 41 | 41 | }; | 42 | 42 |
| 43 | 43 | const Internals: ReactDOMInternals = { | |
|