Skip to content

Conversation

@acdlite
Copy link
Collaborator

@acdlite acdlite commented Feb 5, 2019

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.)

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.)
export const cancelTimeout = clearTimeout;
export const noTimeout = -1;
export const schedulePassiveEffects = scheduleDeferredCallback;
export const cancelPassiveEffects = cancelDeferredCallback;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems a little weird now that we're exporting these multiple times with the same name ¯_(ツ)_/¯ Oh well though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tiny nit: This is unlikely to conflict, but should we maybe pick something a little longer and more unique?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gotcha

@sizebot
Copy link

sizebot commented Feb 5, 2019

Details of bundled changes.

Comparing: 81470a0...e0ea64b

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-test-renderer.development.js -0.1% -0.1% 473.4 KB 472.88 KB 100.59 KB 100.5 KB UMD_DEV
react-test-renderer.production.min.js -0.1% 🔺+0.1% 63.05 KB 63 KB 19.44 KB 19.45 KB UMD_PROD
react-test-renderer.development.js 0.0% 0.0% 468.36 KB 468.46 KB 99.36 KB 99.37 KB NODE_DEV
react-test-renderer.production.min.js -0.1% -0.1% 62.71 KB 62.64 KB 19.18 KB 19.16 KB NODE_PROD
ReactTestRenderer-dev.js 0.0% 0.0% 477.8 KB 477.9 KB 98.99 KB 99 KB FB_WWW_DEV
react-test-renderer-shallow.development.js 0.0% -0.0% 36.84 KB 36.84 KB 9.38 KB 9.38 KB UMD_DEV
react-test-renderer-shallow.development.js 0.0% -0.0% 31.14 KB 31.14 KB 8 KB 8 KB NODE_DEV

react-noop-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-noop-renderer.development.js +3.5% +2.8% 28.16 KB 29.16 KB 6.15 KB 6.32 KB NODE_DEV
react-noop-renderer.production.min.js 🔺+4.7% 🔺+3.2% 10.64 KB 11.14 KB 3.55 KB 3.67 KB NODE_PROD
react-noop-renderer-persistent.development.js +3.5% +2.8% 28.28 KB 29.27 KB 6.16 KB 6.33 KB NODE_DEV
react-noop-renderer-persistent.production.min.js 🔺+4.7% 🔺+3.1% 10.66 KB 11.16 KB 3.56 KB 3.67 KB NODE_PROD
react-noop-renderer-server.development.js 0.0% -0.2% 1.83 KB 1.83 KB 877 B 875 B NODE_DEV
react-noop-renderer-server.production.min.js 0.0% -0.4% 813 B 813 B 491 B 489 B NODE_PROD

Generated by 🚫 dangerJS

@acdlite acdlite merged commit fb3f7bf into facebook:master Feb 5, 2019
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants