Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c03a057

Browse files
committed
Register null component IDs at componentDidMount
This pushes registering of null component IDs to componentDidMount. The result that null component IDs are never registered during server-side rendering, which fixes a memory leak with null component IDs never being cleaned up server-side.
1 parent 9ce4be4 commit c03a057

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/renderers/shared/reconciler/ReactEmptyComponent.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ var ReactEmptyComponentInjection = {
2525
},
2626
};
2727

28+
function registerNullComponentID() {
29+
ReactEmptyComponentRegistry.registerNullComponentID(this._rootNodeID);
30+
}
31+
2832
var ReactEmptyComponent = function(instantiate) {
2933
this._currentElement = null;
3034
this._rootNodeID = null;
@@ -34,7 +38,7 @@ assign(ReactEmptyComponent.prototype, {
3438
construct: function(element) {
3539
},
3640
mountComponent: function(rootID, transaction, context) {
37-
ReactEmptyComponentRegistry.registerNullComponentID(rootID);
41+
transaction.getReactMountReady().enqueue(registerNullComponentID, this);
3842
this._rootNodeID = rootID;
3943
return ReactReconciler.mountComponent(
4044
this._renderedComponent,

0 commit comments

Comments
 (0)