Avoid importing Scheduler directly#14757
Merged
acdlite merged 2 commits intofacebook:masterfrom Feb 5, 2019
Merged
Conversation
The reconciler should not depend directly on Scheduler. This adds it to the host config for the renderer instead. (Except for `scheduler/tracing` imports, which are used only by the profiling build. I've left those imports as-is, though I'm open to directing those through the host config, too.)
bvaughn
approved these changes
Feb 5, 2019
| export const cancelTimeout = clearTimeout; | ||
| export const noTimeout = -1; | ||
| export const schedulePassiveEffects = scheduleDeferredCallback; | ||
| export const cancelPassiveEffects = cancelDeferredCallback; |
Contributor
There was a problem hiding this comment.
Seems a little weird now that we're exporting these multiple times with the same name ¯_(ツ)_/¯ Oh well though.
Collaborator
Author
There was a problem hiding this comment.
Right this change doesn't have much immediate impact, but gives us flexibility to customize the implementation in the future. For example, noop renderer already has a forked implementation.
| flushPassiveEffects() { | ||
| // Trick to flush passive effects without exposing an internal API: | ||
| // Create a throwaway root and schedule a dummy update on it. | ||
| const rootID = 'bloop'; |
Contributor
There was a problem hiding this comment.
tiny nit: This is unlikely to conflict, but should we maybe pick something a little longer and more unique?
sebmarkbage
approved these changes
Feb 5, 2019
Details of bundled changes.Comparing: 81470a0...e0ea64b react-test-renderer
react-noop-renderer
Generated by 🚫 dangerJS |
NMinhNguyen
referenced
this pull request
in enzymejs/react-shallow-renderer
Jan 29, 2020
* Avoid importing Scheduler directly The reconciler should not depend directly on Scheduler. This adds it to the host config for the renderer instead. (Except for `scheduler/tracing` imports, which are used only by the profiling build. I've left those imports as-is, though I'm open to directing those through the host config, too.) * Make throwaway root id longer to appease Brian
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The reconciler should not depend directly on Scheduler. This adds it to the host config for the renderer instead.
(Except for
scheduler/tracingimports, which are used only by the profiling build. I've left those imports as-is, though I'm open to directing those through the host config, too.)