1). LWC: Use the Improved Conditional Directives
The lwc:if, lwc:elseif, and lwc: else conditional directives supersede the legacy of if: true and if: false directives.
With the lwc:if, lwc:elseif, and lwc: else conditional directives, the property getters are accessed only one time per instance of the directive.
<!-- conditionalExample.html -->
<template>
<template lwc:if={variable1}>
Value here
</template>
<template lwc:elseif={variable2}>
Value here.
</template>
<template lwc:else>
Value here.
</template>
</template>
2). Secure Apex Code with User Mode
The new Database and Search methods support an accessLevel parameter that lets you run database and search operations in user mode instead of in the default system mode.
You can indicate the mode of the operation by using WITH USER_MODE or WITH SYSTEM_MODE in your SOQL query. This example specifies user mode.
List<Account> acc = [SELECT Id FROM Account WITH USER_MODE];
Database operations can specify user or system mode. This example inserts a new account in user mode.
Account acc = new Account(Name=’test’);
insert as user acc;
3). Use the sytsem.enqueueJob Method to Specify a Delay in Scheduling Queueable Jobs
A new optional override adds queueable jobs to the asynchronous execution queue with a specified minimum delay (0–10 minutes). Using the System. enqueue(queueable, delay) method ignores any org-wide enqueue delay setting. The delay is ignored during Apex testing.
Here are some cases where it can be beneficial to adjust the timing before the queueable job runs.
-
If the external system is rate-limited and can be overloaded by chained queueable jobs that are making rapid callouts.
-
When polling for results, and executing too fast can cause wasted usage of the daily async Apex limits.
This example adds a job for delayed asynchronous execution by passing in an instance of your class implementation of the Queueable interface for execution. There’s a minimum delay of 5 minutes before the job is executed.
Integer delayInMinutes = 5;
ID jobID = System.enqueueJob(new MyQueueableClass(), delayInMinutes);