What is going to Deprecated & What is coming new in LWC

LWC

=============== Deprecated =============

<<<<<<<<<<<<<<<<<<<< < lightning/uiRecordApi >>>>>>>>>>>>>>>>>>>

getRecordUi (Deprecated) Support for this wire adapter ends on May 1, 2023. We recommend using the lightning-record-form, lightning-record-edit-form, and lightning-record-view-form base components to enable users to work with records.

getRecordInput (Deprecated)—Support for this function ends on May 1, 2023. We recommend constructing the record object in your code with the apiName and fields properties instead.

refresh (Deprecated)—Support for this function ends on May 1, 2023. We recommend using refreshApex or getRecordNotifyChange instead.

<<<<<<<<<<<<<<<<<<< salesforce/apex >>>>>>>>>>>>>>>>>>>>

refreshApex—This function is deprecated for the non-Apex usage of the function. Support for non-Apex usage of the function ends on May 1, 2023.
We recommend using the getRecordNotifyChange function instead to refresh record data returned by a non-Apex wire adapter. refreshApex continues to be supported for data returned by a wire adapter that uses Apex.

============= New Modules ==============

<<<<<<<<<<<<<<<<<<< lightning/modal >>>>>>>>>>>>>>>>>>>

This module includes a new library used to create the new modal component.
LightningModal— Extend this component instead of LightningElement to create a modal. LightningModal gives your component access to the normal LWC resources and the special modal container, helper components, methods, and events.

/* c/myModal.js */
import LightningModal from 'lightning/modal';

export default class MyModal extends LightningModal {
    /* component content */
}

<<<<<<<<<<<<<<<<<< lightning/fileDownload >>>>>>>>>>>>>>>>>

Enables file downloads from custom components in Build Your Own (LWR) template sites. Generates a URL that lets users download Salesforce files, attachments, and documents from desktop and mobile devices.

<<<<<<<<<<<<<<<<< experience/cmsEditorApi >>>>>>>>>>>>>>>>>>

The new wire adapters are:
getContent
—Retrieves the title, urlName, and contentBody of the content item based on the content type—image, news, document, or custom content.

getContext—Retrieves metadata that provides contextual information about the content item in the CMS content editor.

The new method is:
setContent—Updates the title and contentBody of the content item in the editor.

import { LightningElement, wire } from 'lwc';
import { getContext }  from 'experience/cmsEditorApi';
export default class Example extends LightningElement {
    @wire(getContext, {})
    context;
}

<<<<<<<<<<<<<<<<< experience/cmsDeliveryApi >>>>>>>>>>>>>>>>>>>

Use the experience/cmsDeliveryApi module to retrieve content from an enhanced CMS workspace. The getContent wire adapter retrieves published content from the workspace to use in a custom Lightning web component in an enhanced LWR site.

Where: This change applies to LWR sites accessed through Lightning Experience and Salesforce Classic in Enterprise, Performance, Unlimited, and Developer editions.

How: The getContent wire adapter retrieves content only from an enhanced CMS workspace.

import { LightningElement, api, wire } from 'lwc';
import { getContent } from 'experience/cmsDeliveryApi';
import siteId from '@salesforce/site/Id';

export default class GetContentCmsDelivery extends LightningElement{

    @api
    contentKey;

    data;

    @wire(getContent, {channelOrSiteId: siteId, contentKeyOrId: '$contentKey'})
    onGetContent(result) {
        if result.data) {
            this.data = result.data;
        }
    }
}

Leave a Reply