Skip to content

Commit 641eedd

Browse files
committed
Remove component.base
1 parent abf813b commit 641eedd

12 files changed

+24
-752
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
@@ -110,7 +110,8 @@ function unmountComponentAtNode(container) {
110110
function findDOMNode(component) {
111111
return (
112112
(component &&
113-
(component.base || (component.nodeType === 1 && component))) ||
113+
((component._vnode && component._vnode._dom) ||
114+
(component.nodeType === 1 && component))) ||
114115
null
115116
);
116117
}

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
@@ -257,8 +257,6 @@ export function diff(
257257
refQueue
258258
);
259259

260-
c.base = newVNode._dom;
261-
262260
// We successfully rendered this VNode, unset any stored hydration/bailout state:
263261
newVNode._flags &= RESET_MODE;
264262

@@ -607,7 +605,7 @@ export function unmount(vnode, parentVNode, skipRemove) {
607605
}
608606
}
609607

610-
r.base = r._parentDom = null;
608+
r._parentDom = null;
611609
}
612610

613611
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.

src/internal.d.ts

-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ declare global {
167167
// When component is functional component, this is reset to functional component
168168
constructor: ComponentType<P>;
169169
state: S; // Override Component["state"] to not be readonly for internal use, specifically Hooks
170-
base?: PreactElement;
171170

172171
_dirty: boolean;
173172
_force?: boolean;

0 commit comments

Comments
 (0)