Lightning Data Services

  • LDS manages data for you; changes to a record are reflected in all the technologies built on it. 
  • Records loaded in LDS are cached and shared across components. 
  • Accessing the same record see significant performance improvements, because a record is loaded once, no matter how many components are using it. 
  • Components—lightning-record-edit-form, lightning-record-form, and lightning-record-view-form 
  • They provide a UI to view, create, and edit a record—similar to the record detail page in Salesforce. 
  • Use the lightning-record-*-form components to: 
    • Create a metadata-driven UI or form-based UI similar to the record detail page in Salesforce. 
    • Display record values based on the field metadata. 
    • Display or hide localized field labels. 
    • Display the help text on a custom field. 
    • Perform client-side validation and enforce validation rules 

 

lightning-record-form 

  • way to display a form to create, edit, or view a record. 
  • The form switches between view and edit modes automatically when the user begins editing a field.  
  • The component uses the object's default record layout with support for multiple columns.  
  • It loads all fields in the object's compact or full layout, or only the fields that you specify. 
  • To improve performance, specify fields instead of a layout whenever possible. 

lightning-record-edit-form and lightning-record-view-form 

  • To customize the form display or provide custom rendering of record data, use lightning-record-edit-form (to add or update a record) and lightning-record-view-form (to view a record).  
  • lightning-record-edit-form enables you to prepopulate field values using the lightning-input-field component. 
  • You have more control over the fields. To apply custom UI. 

 

Wire adapters and functions in the lightning/ui*Api modules 

  • @wire – decorator is used on the components 
  • If LDS detects a change to a record or any data or metadata it supports, all components using a relevant @wire adapter receive the new value. 
  • LDS Detection triggers if: 
    • A Lightning web component mutates the record. 
    • The LDS cache entry expires and then a Lightning web component's @wire triggers a read. The cache entry and the Lightning web component must be in the same browser and app (for example Lightning Experience) for the same user. 
  • LDS tasks: 
    • Loads record data progressively. 
    • Caches results on the client. 
    • Invalidates cache entries when dependent Salesforce data and metadata changes. 
    • Optimizes server calls by bulkifying and deduping requests. 

 

  • LDS maintains a client-side cache of record data that has been loaded via a wire adapter.  
  • Lightning Data Service re-requests the record data from the server to satisfy requests that occur after the cache lifetime.  
  • However, you might also get updated record data even before the cache lifetime has passed. The cache lifetime is subject to change as part of ongoing improvements to Lightning Data Service. 
  • LDS maintains a separate timeout for object and layout metadata, which are cached in a durable store.  
  • When you make layout changes to record pages on custom objects, the layout changes don't appear immediately.  
  • The record page displays the updated layout after the timeout when you reload the page. To see your layout changes immediately, log out and log back in.  
  • Durable caching is available in orgs with secure browser caching, which is enabled by default. 
  •  
  • Browser  Lightning Web Components  Lightning Data Service  Server  User Interface API  Database

lightning/ui*Api Wire Adapters and Functions 



Read more on TOI
More from ChatGPT
null

No comments:

Powered by Blogger.