@lwc/engine-core 8.21.6 → 8.22.3

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 CHANGED
@@ -611,12 +611,23 @@ function componentValueObserved(vm, key, target = {}) {
611
611
  if (lwcRuntimeFlags.ENABLE_EXPERIMENTAL_SIGNALS &&
612
612
  shared.isObject(target) &&
613
613
  !shared.isNull(target) &&
614
- shared.isTrustedSignal(target) &&
615
614
  process.env.IS_BROWSER &&
616
615
  // Only subscribe if a template is being rendered by the engine
617
616
  tro.isObserving()) {
618
- // Subscribe the template reactive observer's notify method, which will mark the vm as dirty and schedule hydration.
619
- subscribeToSignal(component, target, tro.notify.bind(tro));
617
+ /**
618
+ * The legacy validation behavior was that this check should only
619
+ * be performed for runtimes that have provided a trustedSignals set.
620
+ * However, this resulted in a bug as all object values were
621
+ * being considered signals in environments where the trustedSignals
622
+ * set had not been defined. The runtime flag has been added as a killswitch
623
+ * in case the fix needs to be reverted.
624
+ */
625
+ if (lwcRuntimeFlags.ENABLE_LEGACY_SIGNAL_CONTEXT_VALIDATION
626
+ ? shared.legacyIsTrustedSignal(target)
627
+ : shared.isTrustedSignal(target)) {
628
+ // Subscribe the template reactive observer's notify method, which will mark the vm as dirty and schedule hydration.
629
+ subscribeToSignal(component, target, tro.notify.bind(tro));
630
+ }
620
631
  }
621
632
  }
622
633
  function createReactiveObserver(callback) {
@@ -7220,7 +7231,14 @@ function flushRehydrationQueue() {
7220
7231
  for (let i = 0, len = vms.length; i < len; i += 1) {
7221
7232
  const vm = vms[i];
7222
7233
  try {
7223
- rehydrate(vm);
7234
+ // We want to prevent rehydration from occurring when nodes are detached from the DOM as this can trigger
7235
+ // unintended side effects, like lifecycle methods being called multiple times.
7236
+ // For backwards compatibility, we use a flag to control the check.
7237
+ // 1. When flag is off, always rehydrate (legacy behavior)
7238
+ // 2. When flag is on, only rehydrate when the VM state is connected (fixed behavior)
7239
+ if (!lwcRuntimeFlags.DISABLE_DETACHED_REHYDRATION || vm.state === 1 /* VMState.connected */) {
7240
+ rehydrate(vm);
7241
+ }
7224
7242
  }
7225
7243
  catch (error) {
7226
7244
  if (i + 1 < len) {
@@ -8741,5 +8759,5 @@ exports.swapTemplate = swapTemplate;
8741
8759
  exports.track = track;
8742
8760
  exports.unwrap = unwrap;
8743
8761
  exports.wire = wire;
8744
- /** version: 8.21.6 */
8762
+ /** version: 8.22.3 */
8745
8763
  //# sourceMappingURL=index.cjs.js.map
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright (c) 2025 Salesforce, Inc.
3
3
  */
4
- import { noop, StringToLowerCase, isNull, ArrayPush as ArrayPush$1, ArrayJoin, isFrozen, isUndefined as isUndefined$1, defineProperty, seal, create, isAPIFeatureEnabled, isFunction as isFunction$1, keys, toString, isString, ArrayFilter, isObject, isArray as isArray$1, getOwnPropertyNames as getOwnPropertyNames$1, getOwnPropertySymbols as getOwnPropertySymbols$1, ArrayIndexOf, ArrayPop, isFalse, isTrustedSignal, hasOwnProperty as hasOwnProperty$1, entries, AriaPropNameToAttrNameMap, getPropertyDescriptor, AriaAttrNameToPropNameMap, forEach, REFLECTIVE_GLOBAL_PROPERTY_SET, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, defineProperties, assign, freeze, assert, KEY__SYNTHETIC_MODE, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, LWC_VERSION_COMMENT_REGEX, LWC_VERSION, getOwnPropertyDescriptors, htmlPropertyToAttribute, ArraySlice, ArrayMap, isTrue, KEY__SCOPED_CSS, KEY__NATIVE_ONLY_CSS, ArraySplice, flattenStylesheets, kebabCaseToCamelCase, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, StringSlice, SVG_NAMESPACE, KEY__SHADOW_STATIC, ArraySome, KEY__SHADOW_RESOLVER, normalizeClass, sanitizeHtmlContent, StringReplace, isNumber, ArraySort, ArrayFrom, StringCharAt, htmlEscape, LOWEST_API_VERSION, getContextKeys, isTrustedContext, ContextEventName, ArrayUnshift, KEY__NATIVE_GET_ELEMENT_BY_ID, KEY__NATIVE_QUERY_SELECTOR_ALL, KEY__SHADOW_TOKEN, ID_REFERENCING_ATTRIBUTES_SET, StringSplit, arrayEvery, parseStyleText, ArrayCopyWithin, ArrayFill, ArrayReverse, ArrayShift } from '@lwc/shared';
4
+ import { noop, StringToLowerCase, isNull, ArrayPush as ArrayPush$1, ArrayJoin, isFrozen, isUndefined as isUndefined$1, defineProperty, seal, create, isAPIFeatureEnabled, isFunction as isFunction$1, keys, toString, isString, ArrayFilter, isObject, isArray as isArray$1, getOwnPropertyNames as getOwnPropertyNames$1, getOwnPropertySymbols as getOwnPropertySymbols$1, ArrayIndexOf, ArrayPop, isFalse, legacyIsTrustedSignal, isTrustedSignal, hasOwnProperty as hasOwnProperty$1, entries, AriaPropNameToAttrNameMap, getPropertyDescriptor, AriaAttrNameToPropNameMap, forEach, REFLECTIVE_GLOBAL_PROPERTY_SET, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, defineProperties, assign, freeze, assert, KEY__SYNTHETIC_MODE, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, LWC_VERSION_COMMENT_REGEX, LWC_VERSION, getOwnPropertyDescriptors, htmlPropertyToAttribute, ArraySlice, ArrayMap, isTrue, KEY__SCOPED_CSS, KEY__NATIVE_ONLY_CSS, ArraySplice, flattenStylesheets, kebabCaseToCamelCase, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, StringSlice, SVG_NAMESPACE, KEY__SHADOW_STATIC, ArraySome, KEY__SHADOW_RESOLVER, normalizeClass, sanitizeHtmlContent, StringReplace, isNumber, ArraySort, ArrayFrom, StringCharAt, htmlEscape, LOWEST_API_VERSION, getContextKeys, isTrustedContext, ContextEventName, ArrayUnshift, KEY__NATIVE_GET_ELEMENT_BY_ID, KEY__NATIVE_QUERY_SELECTOR_ALL, KEY__SHADOW_TOKEN, ID_REFERENCING_ATTRIBUTES_SET, StringSplit, arrayEvery, parseStyleText, ArrayCopyWithin, ArrayFill, ArrayReverse, ArrayShift } from '@lwc/shared';
5
5
  export { addTrustedContext, isTrustedSignal, setContextKeys, setHooks, setTrustedContextSet, setTrustedSignalSet } from '@lwc/shared';
6
6
  export { setFeatureFlag, setFeatureFlagForTest } from '@lwc/features';
7
7
  export { SignalBaseClass } from '@lwc/signals';
@@ -608,12 +608,23 @@ function componentValueObserved(vm, key, target = {}) {
608
608
  if (lwcRuntimeFlags.ENABLE_EXPERIMENTAL_SIGNALS &&
609
609
  isObject(target) &&
610
610
  !isNull(target) &&
611
- isTrustedSignal(target) &&
612
611
  process.env.IS_BROWSER &&
613
612
  // Only subscribe if a template is being rendered by the engine
614
613
  tro.isObserving()) {
615
- // Subscribe the template reactive observer's notify method, which will mark the vm as dirty and schedule hydration.
616
- subscribeToSignal(component, target, tro.notify.bind(tro));
614
+ /**
615
+ * The legacy validation behavior was that this check should only
616
+ * be performed for runtimes that have provided a trustedSignals set.
617
+ * However, this resulted in a bug as all object values were
618
+ * being considered signals in environments where the trustedSignals
619
+ * set had not been defined. The runtime flag has been added as a killswitch
620
+ * in case the fix needs to be reverted.
621
+ */
622
+ if (lwcRuntimeFlags.ENABLE_LEGACY_SIGNAL_CONTEXT_VALIDATION
623
+ ? legacyIsTrustedSignal(target)
624
+ : isTrustedSignal(target)) {
625
+ // Subscribe the template reactive observer's notify method, which will mark the vm as dirty and schedule hydration.
626
+ subscribeToSignal(component, target, tro.notify.bind(tro));
627
+ }
617
628
  }
618
629
  }
619
630
  function createReactiveObserver(callback) {
@@ -7217,7 +7228,14 @@ function flushRehydrationQueue() {
7217
7228
  for (let i = 0, len = vms.length; i < len; i += 1) {
7218
7229
  const vm = vms[i];
7219
7230
  try {
7220
- rehydrate(vm);
7231
+ // We want to prevent rehydration from occurring when nodes are detached from the DOM as this can trigger
7232
+ // unintended side effects, like lifecycle methods being called multiple times.
7233
+ // For backwards compatibility, we use a flag to control the check.
7234
+ // 1. When flag is off, always rehydrate (legacy behavior)
7235
+ // 2. When flag is on, only rehydrate when the VM state is connected (fixed behavior)
7236
+ if (!lwcRuntimeFlags.DISABLE_DETACHED_REHYDRATION || vm.state === 1 /* VMState.connected */) {
7237
+ rehydrate(vm);
7238
+ }
7221
7239
  }
7222
7240
  catch (error) {
7223
7241
  if (i + 1 < len) {
@@ -8667,5 +8685,5 @@ function readonly(obj) {
8667
8685
  }
8668
8686
 
8669
8687
  export { BaseBridgeElement, LightningElement, profilerControl as __unstable__ProfilerControl, reportingControl as __unstable__ReportingControl, api$1 as api, computeShadowAndRenderMode, connectRootElement, createContextProviderWithRegister, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentAPIVersion, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, hydrateRoot, isComponentConstructor, parseFragment, parseSVGFragment, readonly, registerComponent, registerDecorators, registerTemplate, runFormAssociatedCallback, runFormDisabledCallback, runFormResetCallback, runFormStateRestoreCallback, sanitizeAttribute, shouldBeFormAssociated, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
8670
- /** version: 8.21.6 */
8688
+ /** version: 8.22.3 */
8671
8689
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "You can safely modify dependencies, devDependencies, keywords, etc., but other props will be overwritten."
5
5
  ],
6
6
  "name": "@lwc/engine-core",
7
- "version": "8.21.6",
7
+ "version": "8.22.3",
8
8
  "description": "Core LWC engine APIs.",
9
9
  "keywords": [
10
10
  "lwc"
@@ -46,9 +46,9 @@
46
46
  }
47
47
  },
48
48
  "dependencies": {
49
- "@lwc/features": "8.21.6",
50
- "@lwc/shared": "8.21.6",
51
- "@lwc/signals": "8.21.6"
49
+ "@lwc/features": "8.22.3",
50
+ "@lwc/shared": "8.22.3",
51
+ "@lwc/signals": "8.22.3"
52
52
  },
53
53
  "devDependencies": {
54
54
  "observable-membrane": "2.0.0"