Yep, #Winter19 is here and it brings a lot of new features with it. In this post, let’s discuss a few of the new and changed features in #Lightning.
1. Cacheable Methods – Now you can mark your @AuraEnabled method cacheable
Instead of calling action.setStorable() on each action (actions are used to make an Apex Call from lightning component), now you can mark your @AuraEnabled methods as cacheable. Below is a simple syntax for the same:
- This change enables you to centralize your caching notation for a method in the Apex class.
- This change is versioned. Any existing component code with an API version of 43.0 or lower will continue to work without any changes. This means:
- If you are using API 43 or lower, and not using the setStorable method in your action, your data will not be cached even if the method is annotated with cacheable=true
- If you are using API 44 or higher, these changes will apply and your data will be cached if the method is annotated with cacheable=true.
2. lightning:empApi – New Lightning component to subscribe to a Streaming event
If you have gone through my streaming API post here, I have created a generic component to subscribe to PushTopic channel and listen to the events.
Well, you do not have to do that anymore, Salesforce has introduced new lightning component lightning:empApi which is capable of handling all streaming events generated from Streaming API, Platform events, Generic Events and Change Data Capture events.
The lightning:empApi component uses a shared CometD-based Streaming API connection, enabling you to run multiple streaming apps in the browser.
3. lightning:map- Now display google map by using this new Lightning Component
This is my favourite. Now you can display google map in your Lightning component by using lightning:map base component. This component securely displays a map of one or more locations using Google Maps.
You can pass markers to the component to define the locations to map. A marker can be a coordinate pair of latitude and longitude, or a set of address elements: City, Country, PostalCode, State, and Street.
4. lightning:menuDivider – New Lightning Component
Use lightning:menuDivider to create a dividing line after a menu item. By default, space is added above and below the divider. Use variant=”compact” with lightning:menuDivider to reduce the space.
5. lightning:menuSubheader – New Lightning Component
This component is used as a child component of lightning:buttonMenu. Use lightning:menuSubheader to create subheadings in the list of menu items. Specify the text of the heading using the label attribute.
6. lightning:datatable – New enahncements in lightning:datatable
- button-icon – New column type in datatable to display an icon only button.
- tooltip—Displays a tooltip for a URL in the datatable column. Use the typeAttributes property to pass the tooltip for the URL.
7. lightning:inputField – New enahncements in lightning:inputField
- The lightning:inputField component now supports the geolocation field type. It displays input fields for entering latitude and longitude in decimal degrees.
8. lightning:listView – New attribute added to show search bar
showSearchBar—Specifies whether the search bar displays. This value defaults to false. The server side can still disable search if it does not support searching
9. Enable CDN to Load Lightning Experience Faster
You can now enable content delivery network(CDN) to load lightning apps faster. A CDN generally speeds up page load time, but it also changes the source domain that serves the files.
Note: If your company has IP range restrictions for content served from Salesforce, test thoroughly before enabling this setting.
Winter 19 has a lot for Salesforce developers and makes it even easier to write code and implement features. The source of above post and content is official release notes.