Skip to content

Commit 6efe100

Browse files
committed
Remove component.base
1 parent fcace4c commit 6efe100

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

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

@@ -608,7 +606,7 @@ export function unmount(vnode, parentVNode, skipRemove) {
608606
}
609607
}
610608

611-
r.base = r._parentDom = null;
609+
r._parentDom = null;
612610
}
613611

614612
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)