Skip to content
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

Remove component.base #4453

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion compat/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ function unmountComponentAtNode(container) {
function findDOMNode(component) {
return (
(component &&
(component.base || (component.nodeType === 1 && component))) ||
((component._vnode && component._vnode._dom) ||
(component.nodeType === 1 && component))) ||
null
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ function renderComponent(component) {
*/
function updateParentDomPointers(vnode) {
if ((vnode = vnode._parent) != null && vnode._component != null) {
vnode._dom = vnode._component.base = null;
vnode._dom = null;
for (let i = 0; i < vnode._children.length; i++) {
let child = vnode._children[i];
if (child != null && child._dom != null) {
vnode._dom = vnode._component.base = child._dom;
vnode._dom = child._dom;
break;
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/diff/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,6 @@ export function diff(
refQueue
);

c.base = newVNode._dom;

// We successfully rendered this VNode, unset any stored hydration/bailout state:
newVNode._flags &= RESET_MODE;

Expand Down Expand Up @@ -607,7 +605,7 @@ export function unmount(vnode, parentVNode, skipRemove) {
}
}

r.base = r._parentDom = null;
r._parentDom = null;
}

if ((r = vnode._children)) {
Expand Down
1 change: 0 additions & 1 deletion src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ export abstract class Component<P, S> {
state: Readonly<S>;
props: RenderableProps<P>;
context: any;
base?: Element | Text;

// From https://github.com/DefinitelyTyped/DefinitelyTyped/blob/e836acc75a78cf0655b5dfdbe81d69fdd4d8a252/types/react/index.d.ts#L402
// // We MUST keep setState() as a unified signature because it allows proper checking of the method return type.
Expand Down
1 change: 0 additions & 1 deletion src/internal.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ declare global {
// When component is functional component, this is reset to functional component
constructor: ComponentType<P>;
state: S; // Override Component["state"] to not be readonly for internal use, specifically Hooks
base?: PreactElement;

_dirty: boolean;
_force?: boolean;
Expand Down
Loading
Loading