Skip to content

Commit a475c94

Browse files
committed
Try shorter property name to get inlining
1 parent fcbb369 commit a475c94

File tree

3 files changed

+14
-27
lines changed

3 files changed

+14
-27
lines changed

packages/react-dom-bindings/src/client/ReactDOMUpdatePriority.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,24 @@ import {
1616
} from 'react-reconciler/src/ReactEventPriorities';
1717

1818
import ReactDOMSharedInternals from 'shared/ReactDOMSharedInternals';
19-
const ReactDOMCurrentUpdatePriority =
20-
ReactDOMSharedInternals.ReactDOMCurrentUpdatePriority;
2119

22-
export function setCurrentUpdatePriority(newPriority: EventPriority): void {
23-
ReactDOMCurrentUpdatePriority.current = newPriority;
20+
export function setCurrentUpdatePriority(
21+
newPriority: EventPriority,
22+
// Closure will consistently not inline this function when it has arity 1
23+
// however when it has arity 2 even if the second arg is omitted at every
24+
// callsite it seems to inline it even when the internal length of the function
25+
// is much longer. I hope this is consistent enough to rely on across builds
26+
IntentionallyUnusedArgument?: empty,
27+
): void {
28+
ReactDOMSharedInternals.up = newPriority;
2429
}
2530

2631
export function getCurrentUpdatePriority(): EventPriority {
27-
return ReactDOMCurrentUpdatePriority.current;
32+
return ReactDOMSharedInternals.up;
2833
}
2934

3035
export function resolveUpdatePriority(): EventPriority {
31-
const updatePriority = ReactDOMCurrentUpdatePriority.current;
36+
const updatePriority = ReactDOMSharedInternals.up;
3237
if (updatePriority !== NoEventPriority) {
3338
return updatePriority;
3439
}

packages/react-dom/src/ReactDOMSharedInternals.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ type InternalsType = {
2323
| ((
2424
componentOrElement: React$Component<any, any>,
2525
) => null | Element | Text),
26-
ReactDOMCurrentUpdatePriority: {
27-
current: EventPriority,
28-
},
26+
up /* currentUpdatePriority */: EventPriority,
2927
};
3028

3129
function noop() {}
@@ -47,9 +45,7 @@ const Internals: InternalsType = {
4745
current: DefaultDispatcher,
4846
},
4947
findDOMNode: null,
50-
ReactDOMCurrentUpdatePriority: {
51-
current: NoEventPriority,
52-
},
48+
up /* currentUpdatePriority */: NoEventPriority,
5349
};
5450

5551
export default Internals;

packages/shared/ReactVersion.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1 @@
1-
/**
2-
* Copyright (c) Meta Platforms, Inc. and affiliates.
3-
*
4-
* This source code is licensed under the MIT license found in the
5-
* LICENSE file in the root directory of this source tree.
6-
*/
7-
8-
// TODO: this is special because it gets imported during build.
9-
//
10-
// It exists as a placeholder so that DevTools can support work tag changes between releases.
11-
// When we next publish a release, update the matching TODO in backend/renderer.js
12-
// TODO: This module is used both by the release scripts and to expose a version
13-
// at runtime. We should instead inject the version number as part of the build
14-
// process, and use the ReactVersions.js module as the single source of truth.
15-
export default '19.0.0';
1+
export default '19.0.0-PLACEHOLDER';

0 commit comments

Comments
 (0)