Skip to content

Commit ef1d6b7

Browse files
committed
Remove component.base
1 parent f0caec3 commit ef1d6b7

11 files changed

+24
-751
lines changed

TODO.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- https://github.com/preactjs/preact/pull/4460
55
- https://github.com/preactjs/preact/pull/4453
66
- Backing VNodes
7+
- Remove deprecated lifecycle methods
78
- Try to get rid of DOM pointers
89
- Separate mount/update paths
910
- Rethink TypeScript types

compat/src/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ function unmountComponentAtNode(container) {
116116
function findDOMNode(component) {
117117
return (
118118
(component &&
119-
(component.base || (component.nodeType === 1 && component))) ||
119+
((component._vnode && component._vnode._dom) ||
120+
(component.nodeType === 1 && component))) ||
120121
null
121122
);
122123
}

src/component.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,11 @@ function renderComponent(component) {
159159
*/
160160
function updateParentDomPointers(vnode) {
161161
if ((vnode = vnode._parent) != null && vnode._component != null) {
162-
vnode._dom = vnode._component.base = null;
162+
vnode._dom = null;
163163
for (let i = 0; i < vnode._children.length; i++) {
164164
let child = vnode._children[i];
165165
if (child != null && child._dom != null) {
166-
vnode._dom = vnode._component.base = child._dom;
166+
vnode._dom = child._dom;
167167
break;
168168
}
169169
}

src/diff/index.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,6 @@ export function diff(
273273
refQueue
274274
);
275275

276-
c.base = newVNode._dom;
277-
278276
// We successfully rendered this VNode, unset any stored hydration/bailout state:
279277
newVNode._flags &= RESET_MODE;
280278

@@ -628,7 +626,7 @@ export function unmount(vnode, parentVNode, skipRemove) {
628626
}
629627
}
630628

631-
r.base = r._parentDom = null;
629+
r._parentDom = null;
632630
}
633631

634632
if ((r = vnode._children)) {

src/index.d.ts

-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ export abstract class Component<P, S> {
159159
state: Readonly<S>;
160160
props: RenderableProps<P>;
161161
context: any;
162-
base?: Element | Text;
163162

164163
// From https://github.com/DefinitelyTyped/DefinitelyTyped/blob/e836acc75a78cf0655b5dfdbe81d69fdd4d8a252/types/react/index.d.ts#L402
165164
// // We MUST keep setState() as a unified signature because it allows proper checking of the method return type.

0 commit comments

Comments
 (0)