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

refactor(engine-core): Remove patching hooks #2677

Merged
merged 14 commits into from
Feb 17, 2022
18 changes: 4 additions & 14 deletions packages/@lwc/engine-core/src/framework/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { EmptyArray } from './utils';
import { isComponentConstructor } from './def';
import { ShadowMode, SlotSet, VM, RenderMode } from './vm';
import { LightningElementConstructor } from './base-lightning-element';
import { markAsDynamicChildren } from './rendering';
import {
VNode,
VNodes,
Expand All @@ -41,13 +42,6 @@ import {
VElementData,
VNodeType,
} from './vnodes';
import {
CommentHook,
CustomElementHook,
ElementHook,
TextHook,
markAsDynamicChildren,
} from './rendering';

const SymbolIterator: typeof Symbol.iterator = Symbol.iterator;

Expand Down Expand Up @@ -104,7 +98,6 @@ function h(sel: string, data: VElementData, children: VNodes): VElement {
children,
elm,
key,
hook: ElementHook,
owner: vmBeingRendered,
};
}
Expand Down Expand Up @@ -208,7 +201,7 @@ function c(
}
}
const { key } = data;
let elm;
let elm, aChildren, vm;
const vnode: VCustomElement = {
type: VNodeType.CustomElement,
sel,
Expand All @@ -217,10 +210,11 @@ function c(
elm,
key,

hook: CustomElementHook,
ctor: Ctor,
owner: vmBeingRendered,
mode: 'open', // TODO [#1294]: this should be defined in Ctor
aChildren,
vm,
};
addVNodeToChildLWC(vnode);
return vnode;
Expand Down Expand Up @@ -346,8 +340,6 @@ function t(text: string): VText {
text,
elm,
key,

hook: TextHook,
owner: getVMBeingRendered()!,
};
}
Expand All @@ -361,8 +353,6 @@ function co(text: string): VComment {
text,
elm,
key,

hook: CommentHook,
owner: getVMBeingRendered()!,
};
}
Expand Down
5 changes: 3 additions & 2 deletions packages/@lwc/engine-core/src/framework/hydration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ function hydrateCustomElement(vnode: VCustomElement, node: Node) {
}

const elm = node as Element;
vnode.elm = elm;

const { sel, mode, ctor, owner } = vnode;

const vm = createVM(elm, ctor, {
Expand All @@ -150,6 +148,9 @@ function hydrateCustomElement(vnode: VCustomElement, node: Node) {
tagName: sel,
});

vnode.elm = elm;
vnode.vm = vm;

allocateChildren(vnode, vm);
patchElementPropsAndAttrs(vnode);

Expand Down
Loading