-
Notifications
You must be signed in to change notification settings - Fork 47.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move priorities to separate import to break cycle (#21060)
The event priority constants exports by the reconciler package are meant to be used by the reconciler (host config) itself. So it doesn't make sense to export them from a module that requires them. To break the cycle, we can move them to a separate module and import that. This looks like a "deep import" of an internal module, which we try to avoid, but conceptually these are part of the public interface of the reconciler module. So, no different than importing from the main `react-reconciler`. We do need to be careful about not mixing these types of imports with implementation details. Those are the ones to really avoid. An unintended benefit of the reconciler fork infra is that it makes deep imports harder. Any module that we treat as "public", like this one, needs to account for the `enableNewReconciler` flag and forward to the correct implementation.
- Loading branch information
Showing
13 changed files
with
129 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
*/ | ||
|
||
import {enableNewReconciler} from 'shared/ReactFeatureFlags'; | ||
|
||
import { | ||
DiscreteEventPriority as DiscreteEventPriority_old, | ||
ContinuousEventPriority as ContinuousEventPriority_old, | ||
DefaultEventPriority as DefaultEventPriority_old, | ||
IdleEventPriority as IdleEventPriority_old, | ||
} from './ReactEventPriorities.old'; | ||
|
||
import { | ||
DiscreteEventPriority as DiscreteEventPriority_new, | ||
ContinuousEventPriority as ContinuousEventPriority_new, | ||
DefaultEventPriority as DefaultEventPriority_new, | ||
IdleEventPriority as IdleEventPriority_new, | ||
} from './ReactEventPriorities.new'; | ||
|
||
export const DiscreteEventPriority = enableNewReconciler | ||
? DiscreteEventPriority_new | ||
: DiscreteEventPriority_old; | ||
export const ContinuousEventPriority = enableNewReconciler | ||
? ContinuousEventPriority_new | ||
: ContinuousEventPriority_old; | ||
export const DefaultEventPriority = enableNewReconciler | ||
? DefaultEventPriority_new | ||
: DefaultEventPriority_old; | ||
export const IdleEventPriority = enableNewReconciler | ||
? IdleEventPriority_new | ||
: IdleEventPriority_old; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
*/ | ||
|
||
export { | ||
SyncLanePriority as DiscreteEventPriority, | ||
InputContinuousLanePriority as ContinuousEventPriority, | ||
DefaultLanePriority as DefaultEventPriority, | ||
IdleLanePriority as IdleEventPriority, | ||
} from './ReactFiberLane.new'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
*/ | ||
|
||
export { | ||
SyncLanePriority as DiscreteEventPriority, | ||
InputContinuousLanePriority as ContinuousEventPriority, | ||
DefaultLanePriority as DefaultEventPriority, | ||
IdleLanePriority as IdleEventPriority, | ||
} from './ReactFiberLane.old'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.