-
Notifications
You must be signed in to change notification settings - Fork 48.6k
Only purgeID on ReactDOMComponent unmount #1568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -406,6 +406,7 @@ ReactDOMComponent.Mixin = { | |||
this.unmountChildren(); | |||
ReactEventEmitter.deleteAllListeners(this._rootNodeID); | |||
ReactComponent.Mixin.unmountComponent.call(this); | |||
ReactMount.purgeID(this._rootNodeID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can you move this above the super call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, will do.
Looks good to me. |
Technically, the neatest solution would be for ReactTextComponent to use a |
Or perhaps add it to ReactBrowserComponentMixin? Not sure. |
Hmm, yeah that's a good point. I guess the upside of using |
react-art also uses it: https://github.com/facebook/react-art/blob/c719f03/src/ReactART.js#L184-L189. |
Right, but the solution would be the same for it then, use |
Related to discussion, #1598 |
@@ -97,8 +88,6 @@ var ReactComponent = { | |||
'ReactComponent: injectEnvironment() can only be called once.' | |||
); | |||
mountImageIntoNode = ReactComponentEnvironment.mountImageIntoNode; | |||
unmountIDFromEnvironment = | |||
ReactComponentEnvironment.unmountIDFromEnvironment; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the only place using ReactComponentEnvironment.unmountIDFromEnvironment
- can we probably get rid of that now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zpao Hmm? That's exactly what's going on here? :) (I find no occurences of unmountIDFromEnvironment
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, rebased this too. Test plan: |
@sebmarkbage Rewrote to fix conflicts, it's still the same basically, but... I chose to use EDIT: I've also ran this PR against our app and I have witnessed no stale nodes in the nodeCache, except for #2988 which is not caused by this PR.
|
Only purgeID on ReactDOMComponent and ReactDOMTextComponent unmount
Fixes #1567