Skip to content

Releases: salesforce/lwc

v5.0.2

14 Nov 22:39
7e1a435
Compare
Choose a tag to compare

What's Changed

Full Changelog: v5.0.1...v5.0.2

v5.0.1

14 Nov 18:35
5545a67
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v5.0.0...v5.0.1

v5.0.0

08 Nov 19:41
5bf31ea
Compare
Choose a tag to compare

LWC v5.0.0 contains breaking changes. Please read carefully below if you are upgrading from v4.

If you are upgrading from v3, please upgrade to v4 first.

Note

LWC v5 corresponds to Salesforce release Spring '24 (API version 60).

Summary of breaking change

Breaking change

Empty comment nodes as VFragment bookends

Note

On the Salesforce Lightning platform, this change only applies to components with an API version of 60 or above.

Features like slots in light DOM, scoped slots and lwc:if use VFragment as virtual DOM nodes. The underlying implementation of VFragment used empty text nodes to aid the DOM diffing algorithm of @lwc/engine-core. With this change, the empty text nodes are replaced with empty comment nodes.

The impact of this change is expected to be minimal. Test snapshots may need to be updated, where new <!----> comment nodes show up. Additionally, some usage of DOM node APIs may be impacted. If you use childNode, nextSibling, etc in your code, there may be subtle changes in behavior.

  • chore: use comment nodes for VFragment bookends by @divmain in #3846

Other changes

New Contributors

Full Changelog: v4.0.1...v5.0.0

v4.0.1

25 Oct 20:44
f9a6b34
Compare
Choose a tag to compare

What's Changed

Full Changelog: v4.0.0...v4.0.1

v4.0.0

20 Oct 20:01
300b4ea
Compare
Choose a tag to compare

LWC v4.0.0 contains breaking changes. Please read carefully below if you are upgrading from v3.

If you are upgrading from v2, please upgrade to v3 first.

Note

LWC v5 corresponds to Salesforce release Spring '24 (API version 60).

Summary of breaking changes

Breaking changes

ARIA reflection global polyfill is removed

Note

This change only applies to LWC usage outside Salesforce Lightning Experience. This includes Lightning Web Runtime, Jest tests, and off-core scenarios.

The global polyfill of the ARIA reflection API is removed from @lwc/engine-dom. This affects the exposed ARIA APIs on built-in HTML elements.

Removal of non-standard ARIA APIs

Non-standard ARIA reflection APIs such as ariaActiveDescendant and ariaLabelledBy are no longer available on the global Element.prototype. Use the getAttribute/setAttribute format instead:

Non-standard property Standard attribute
ariaActiveDescendant aria-activedescendant
ariaControls aria-controls
ariaDescribedBy aria-describedby
ariaDetails aria-details
ariaErrorMessage aria-errormessage
ariaFlowTo aria-flowto
ariaLabelledBy aria-labelledby
ariaOwns aria-owns

Example of incorrect code:

div.ariaActiveDescendant = 'foo';
console.log(div.ariaActiveDescendant);

Example of correct code:

div.setAttribute('aria-activedescendant', 'foo');
console.log(div.getAttribute('aria-activedescendant'));

In LWC v3, if you are using these non-standard APIs, you will see a warning message in the console:

Element <div> owned by <x-foo> uses non-standard property "ariaLabelledBy". This will be removed in a future version of LWC. See https://sfdc.co/deprecated-aria

LWC v4 is the "future version of LWC" mentioned in the warning.

Note that this change only applies to built-in HTML elements such as <div>, <button>, and <input>. For a LightningElement (e.g. <c-my-component>), the non-standard APIs continue to be supported in LWC v4.

Removal of standard ARIA reflection global polyfill

Some browsers and environments, notably Firefox pre-119 and JSDOM, do not support standard ARIA reflection for properties such as role and ariaLabel. For maximum compatibility, you may use the attribute format instead:

  • element.role -> element.getAttribute('role')
  • element.ariaLabel -> element.getAttribute('aria-label')

If you are using the latest version of @lwc/jest-preset, a polyfill is already included.

Deprecation of @lwc/aria-reflection package

The @lwc/aria-reflection package is considered deprecated. If you need it for backwards compatibility, you may install and import it separately:

import '@lwc/aria-reflection' // applies the polyfill

Note that, on Salesforce Lightning Experience, this polyfill is still in effect for backwards compatibility. However, this is transparent to LWC users.

  • fix(engine-dom): remove ARIA reflection global polyfill (BREAKING CHANGE) by @nolanlawson in #3666

TypeScript types have changed

Note

This change only applies to TypeScript users.

If you are using TypeScript, you may need to update your types to align with the new typings. In particular, the types for @wire and context providers have changed.

  • chore: generics for better typing (BREAKING CHANGE) by @ekashida in #3819

Light DOM may emit additional whitespace characters

Note

On the Salesforce Lightning platform, this change only applies to components with an API version of 60 or above.

Off-core consumers, or those bumping their component's metadata apiVersion to 60+, will see additional empty text nodes rendered in light DOM slots. This can change use cases like the following:

renderedCallback() {
  const myExpectedChildNode = this.childNodes[0];
}

In API versions <60, the above this.childNodes[0] would resolve to the first slotted element in the light DOM component.

In API versions >=60, it will be an empty text node. This is due to the new system using VFragments to enclose light DOM slots, which means there is an additional empty text node before and after the slot.

Affected APIs are:

Component authors are encouraged to use lwc:ref or this.querySelector rather than relying on the exact makeup of child nodes. Using children/firstElementChild/lastElementChild will also work, since text nodes are not elements (simply nodes).

Additionally, Jest snapshots will change to have additional whitespace, unless you have upgraded to lwc-test v13.0.0+.

Decorators are disallowed on non-LightningElement classes

Note

On the Salesforce Lightning platform, this change only applies to components with an API version of 60 or above.

Previously, the following would not be a syntax error:

class MyCustomClass {
  @api foo = 'foo';
}

In v60+, this will be a syntax error. The decorators @track, @wire, and @api can only be used on LightningElement classes. In the above case, MyCustomClass does not extend another class, so it cannot possibly be a LightningElement class.

In this release,the unnecessary @track, @wire, and @api decorators are now removed from classes that do not extend another class. This will cause a breakage in downstream JavaScript compilers such as Babel, unless they are otherwise configured to handle decorators.

This change was made to avoid functional bugs, such as when using Jest mocks containing a class.

  • fix(babel-plugin-component): skip unnecessary registerDecorators (BREAKING CHANGE) by @nolanlawson in #3660

Babel object rest spread transpilation is removed

Note

On the Salesforce Lightning platform, this change only applies to components with an API version of 60 or above.

For the object rest spread syntax (e.g. {...foo}), LWC no longer emits the Babel transpiled version, and instead emits the native syntax (...).

This is mildly breaking because it is observable. In particular, if you have a counter inside of a getter and are relying on the count to report a particular number, then this change will break you because the Babel transform does not behave exactly like the native behavior. E.g.:

let count = 0;
const {
  foo: {
    bar,
    ...quux
  }
} = {
  get foo() {
    count++;
    return { bar: 42 };
  }
};
console.log(count); // Logs 2 for Babel, 1 for native

This is judged as extremely unlikely to break anyone, but it is technically a breaking change.

This change was made as part of a performance improvement, as the native syntax (...) is much shorter than the transpiled syntax.

  • perf(compiler): remove object rest spread (BREAKING CHANGE) by @nolanlawson in #3654

Full changelog

Full Changelog: v3.8.0...v4.0.0

v3.8.0

17 Oct 20:02
0e58325
Compare
Choose a tag to compare

What's Changed

Full Changelog: v3.7.3...v3.8.0

v3.7.3

17 Oct 15:44
8447285
Compare
Choose a tag to compare
v3.7.3 (#3809)

v3.7.2

16 Oct 21:14
650305a
Compare
Choose a tag to compare
chore: release v3.7.2 (#3803)

v3.7.1

13 Oct 00:19
ecc6329
Compare
Choose a tag to compare

What's Changed

  • engine-server/template-compiler: remove parse5 utils by @43081j in #3785
  • test: fix aria tests in Firefox Nightly by @nolanlawson in #3792
  • fix: errorCallback was incorrectly invoked in SSR by @divmain in #3793

New Contributors

Full Changelog: v3.7.0...v3.7.1

v3.7.0

11 Oct 14:45
1a3a527
Compare
Choose a tag to compare

What's Changed

Full Changelog: v3.6.0...v3.7.0