dillon1000/react
Commit
Browse files Consolidate hook events (#7472)
* Remove onBeforeMountComponent hook event It is unnecessary. We now pass the element as part of onInstantiateComponent, and it can't change before mounting. * Remove onComponentHasMounted hook event It is unused after #7410. * Replace on(Begin|End)ReconcilerTimer hook events We already have onBeforeUpdateComponent. Let's just have on(Before?)(Mount|Update|Unmount)Component and stick with them. This removes double event dispatches in some hot spots. * Remove onComponentHasUpdated hook The tests still pass so presumably it was not necessary. * Add missing __DEV__ to TestUtils code * Replace on(InstantiateComponent|SetParent) with onBeforeMountComponent This lets us further consolidate hooks. The parent ID is now passed as an argument to onBeforeMountComponent() with the element. * Remove onMountRootComponent hook event It is unnecessary now that we pass the parent ID to onBeforeMountComponent. * Use parentDebugID = 0 both for roots and production This removes some awkward branching.
Changed paths15 files
First-parent comparisonsrc/isomorphic/hooks/ReactComponentTreeHook.js ModifiedM src/renderers/dom/client/ReactMount.js ModifiedM src/renderers/dom/server/ReactServerRendering.js ModifiedM src/renderers/dom/shared/ReactDOMComponent.js ModifiedM src/renderers/native/ReactNativeMount.js ModifiedM src/renderers/shared/ReactDebugTool.js ModifiedM src/renderers/shared/hooks/ReactChildrenMutationWarningHook.js ModifiedM src/renderers/shared/stack/reconciler/ReactChildReconciler.js ModifiedM src/renderers/shared/stack/reconciler/ReactCompositeComponent.js ModifiedM src/renderers/shared/stack/reconciler/ReactMultiChild.js ModifiedM src/renderers/shared/stack/reconciler/ReactReconciler.js ModifiedM src/renderers/shared/stack/reconciler/ReactSimpleEmptyComponent.js ModifiedM src/renderers/shared/stack/reconciler/instantiateReactComponent.js ModifiedM src/renderers/testing/ReactTestMount.js ModifiedM src/test/ReactTestUtils.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…