Closed
Description
After some research, the following modules in the React codebase have some form of direct dependency on a React Stack module. Ideally, we want to move away form using internal module requires and use public API requires where possible.
ReactTestUtils:
src/test/ReactShallowRenderer.js
- There is a PR already open that should resolve this @lelandrichardson Add createComponentMock option to test renderer #8982
@spicyj says: 👍
- There is a PR already open that should resolve this @lelandrichardson Add createComponentMock option to test renderer #8982
Renderers:
src/renderers/__tests__/ReactUpdates-test.js
- Only one test makes use of
ReactUpdates
directly. Move therequire
to be inline within the test itself?
@spicyj says: this one just tests internals and doesn't test anything observable (originally was added as a part of a very minor perf improvement), can be deleted
- Only one test makes use of
Renderers - ReactDOM:
src/renderers/dom/shared/__tests__/ReactMount-test.js
- A test in this suite uses
ReactMount._instancesByReactRootID
.
@spicyj says: this test was added because the old devtools relied on this and it was important to not break them -- but Dan rewrote the integration so the Fiber devtools don't need this and this test is fine to delete
- A test in this suite uses
src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
- Two tests:
createOpenTagMarkup
andcreateContentMarkup
require Stack modules.
@spicyj says: these tests should be rewritten in terms of public APIs
- Two tests:
src/renderers/dom/shared/__tests__/ReactServerRendering-test.js
- Re-visit once we have SSR working?
@spicyj says: 👍
- Re-visit once we have SSR working?
src/renderers/dom/shared/__tests__/ReactDOMIDOperations-test.js
- Only has a single
innerHTML
whitespace test.
@spicyj says: let's rewrite this one in terms of public APIs (though it can probably move into ReactDOMComponent-test) -- let's ensure that both initial render and updates work properly (since those historically used different codepaths and might also diverge in the future)
- Only has a single
Renderers - ReactDOM SSR:
src/renderers/dom/ReactDOMServer.js
- Re-visit once we have SSR working?
@spicyj says: 👍
- Re-visit once we have SSR working?
Renderers - ReactART:
src/renderers/art/ReactARTStack.js
Renderers - Native:
src/renderers/native/ReactNativeReconcileTransaction.js
src/renderers/native/ReactNativeMount.js
src/renderers/native/ReactNativeStackInjection.js
src/renderers/native/ReactNativeBaseComponent.js
src/renderers/native/ReactNativeStack.js
@spicyj says: No need to worry about these, we'll delete these when we delete stack
@bvaughn says: 👍
Scripts:
scripts/bench/extract-component.js
- Should we refactor to use the public API instead?
@spicyj says: We don't really have a public API for reflecting on/inspecting React trees which is what this script (almost a bookmarklet) does so we will need to rewrite this on top of Fiber if we want to use it again – but this isn't super important so for now this is okay to leave using Stack modules and it will only work with Stack until someone wants to use it and upgrades it to Fiber.
- Should we refactor to use the public API instead?