Skip to content

Commit

Permalink
detach fiber from dom
Browse files Browse the repository at this point in the history
  • Loading branch information
paulshen committed Jun 6, 2019
1 parent d28ee48 commit 2e5ee2f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/react-dom/src/client/ReactDOMComponentTree.js
Expand Up @@ -8,11 +8,11 @@
import {HostComponent, HostText} from 'shared/ReactWorkTags';
import invariant from 'shared/invariant';

const randomKey = Math.random()
.toString(36)
.slice(2);
const internalInstanceKey = '__reactInternalInstance$' + randomKey;
const internalEventHandlersKey = '__reactEventHandlers$' + randomKey;
// const randomKey = Math.random()
// .toString(36)
// .slice(2);
const internalInstanceKey = '__reactInternalInstance$';
const internalEventHandlersKey = '__reactEventHandlers$';

export function precacheFiberNode(hostInst, node) {
node[internalInstanceKey] = hostInst;
Expand Down
3 changes: 3 additions & 0 deletions packages/react-reconciler/src/ReactFiberCommitWork.js
Expand Up @@ -728,6 +728,9 @@ function commitUnmount(current: Fiber): void {
}
case HostComponent: {
safelyDetachRef(current);
// HACK: detach fiber references from DOM
current.stateNode.__reactEventHandlers$ = null;
current.stateNode.__reactInternalInstance$ = null;
break;
}
case HostPortal: {
Expand Down

0 comments on commit 2e5ee2f

Please sign in to comment.