@lwc/engine-core 4.0.0 → 4.0.1

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.js CHANGED
@@ -74,6 +74,12 @@ function report(reportingEventId, payload) {
74
74
  currentDispatcher$1(reportingEventId, payload);
75
75
  }
76
76
  }
77
+ /**
78
+ * Return true if reporting is enabled
79
+ */
80
+ function isReportingEnabled() {
81
+ return enabled$1;
82
+ }
77
83
 
78
84
  /*
79
85
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6034,6 +6040,24 @@ function runConnectedCallback(vm) {
6034
6040
  invokeComponentCallback(vm, connectedCallback);
6035
6041
  logOperationEnd(3 /* OperationId.ConnectedCallback */, vm);
6036
6042
  }
6043
+ // This test only makes sense in the browser, with synthetic lifecycle, and when reporting is enabled or
6044
+ // we're in dev mode. This is to detect a particular issue with synthetic lifecycle.
6045
+ if (process.env.IS_BROWSER &&
6046
+ !lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE &&
6047
+ (process.env.NODE_ENV !== 'production' || isReportingEnabled())) {
6048
+ if (!vm.renderer.isConnected(vm.elm)) {
6049
+ if (process.env.NODE_ENV !== 'production') {
6050
+ logWarnOnce(`Element <${vm.tagName}> ` +
6051
+ `fired a \`connectedCallback\` and rendered, but was not connected to the DOM. ` +
6052
+ `Please ensure all components are actually connected to the DOM, e.g. using ` +
6053
+ `\`document.body.appendChild(element)\`. This will not be supported in future versions of ` +
6054
+ `LWC and could cause component errors. For details, see: https://sfdc.co/synthetic-lifecycle`);
6055
+ }
6056
+ report("ConnectedCallbackWhileDisconnected" /* ReportingEventId.ConnectedCallbackWhileDisconnected */, {
6057
+ tagName: vm.tagName,
6058
+ });
6059
+ }
6060
+ }
6037
6061
  }
6038
6062
  function hasWireAdapters(vm) {
6039
6063
  return getOwnPropertyNames$1(vm.def.wire).length > 0;
@@ -7267,5 +7291,5 @@ function readonly(obj) {
7267
7291
  }
7268
7292
 
7269
7293
  export { 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, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
7270
- /** version: 4.0.0 */
7294
+ /** version: 4.0.1 */
7271
7295
  //# sourceMappingURL=index.js.map