@lwc/engine-core 7.1.4 → 7.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +26 -7
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +26 -7
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs.js
CHANGED
|
@@ -5252,14 +5252,33 @@ function s(slotName, data, children, slotset) {
|
|
|
5252
5252
|
if (renderMode === 0 /* RenderMode.Light */ &&
|
|
5253
5253
|
shared.isAPIFeatureEnabled(6 /* APIFeature.USE_LIGHT_DOM_SLOT_FORWARDING */, apiVersion) &&
|
|
5254
5254
|
(isVBaseElement(vnode) || isVStatic(vnode)) &&
|
|
5255
|
-
// We only need to copy the vnodes when the slot assignment changes, copying every time causes issues with
|
|
5256
|
-
// disconnected/connected callback firing.
|
|
5257
5255
|
vnode.slotAssignment !== data.slotAssignment) {
|
|
5258
|
-
// When the light DOM slot assignment (slot attribute) changes we can't use the same reference
|
|
5259
|
-
// to the vnode because the current way the diffing algo works, it will replace the original
|
|
5260
|
-
// to the host element with a new one. This means the new element will be mounted and
|
|
5261
|
-
// Creating a copy of the vnode
|
|
5256
|
+
// When the light DOM slot assignment (slot attribute) changes, we can't use the same reference
|
|
5257
|
+
// to the vnode because the current way the diffing algo works, it will replace the original
|
|
5258
|
+
// reference to the host element with a new one. This means the new element will be mounted and
|
|
5259
|
+
// immediately unmounted. Creating a copy of the vnode preserves a reference to the previous
|
|
5260
|
+
// host element.
|
|
5262
5261
|
clonedVNode = { ...vnode, slotAssignment: data.slotAssignment };
|
|
5262
|
+
// For disconnectedCallback to work correctly in synthetic lifecycle mode, we need to link the
|
|
5263
|
+
// current VM's velements to the clone, so that when the VM unmounts, the clone also unmounts.
|
|
5264
|
+
// Note this only applies to VCustomElements, since those are the elements that we manually need
|
|
5265
|
+
// to call disconnectedCallback for, when running in synthetic lifecycle mode.
|
|
5266
|
+
//
|
|
5267
|
+
// You might think it would make more sense to add the clonedVNode to the same velements array
|
|
5268
|
+
// as the original vnode's VM (i.e. `vnode.owner.velements`) rather than the current VM (i.e.
|
|
5269
|
+
// `vmBeingRendered.velements`), but this actually might not trigger disconnectedCallback
|
|
5270
|
+
// in synthetic lifecycle mode. The reason for this is that a reactivity change may cause
|
|
5271
|
+
// the slottable component to unmount, but _not_ the slotter component (see issue #4446).
|
|
5272
|
+
//
|
|
5273
|
+
// If this occurs, then the slottable component (i.e .this component we are rendering right
|
|
5274
|
+
// now) is the one that needs to own the clone. Whereas if a reactivity change higher in the
|
|
5275
|
+
// tree causes the slotter to unmount, then the slottable will also unmount. So using the
|
|
5276
|
+
// current VM works either way.
|
|
5277
|
+
if (lwcRuntimeFlags.ENABLE_SLOT_FORWARDING_FIX) {
|
|
5278
|
+
if (isVCustomElement(vnode)) {
|
|
5279
|
+
addVNodeToChildLWC(clonedVNode);
|
|
5280
|
+
}
|
|
5281
|
+
}
|
|
5263
5282
|
}
|
|
5264
5283
|
// If the slot content is standard type, the content is static, no additional
|
|
5265
5284
|
// processing needed on the vnode
|
|
@@ -8099,5 +8118,5 @@ exports.swapTemplate = swapTemplate;
|
|
|
8099
8118
|
exports.track = track;
|
|
8100
8119
|
exports.unwrap = unwrap;
|
|
8101
8120
|
exports.wire = wire;
|
|
8102
|
-
/** version: 7.1.
|
|
8121
|
+
/** version: 7.1.5 */
|
|
8103
8122
|
//# sourceMappingURL=index.cjs.js.map
|