function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Megha SachaniaMegha Sachania 

Lightning Security Review

Can anyone help me out for below issues : 

I am using lightning web component with following code below : 

connectedCallback() { setTimeout(() => { this.ready = true; }, 2000); }

After security review there is a issue listed below which need to  be resolve for above code : 

ISSUE : Any asynchronous function like setTimeout should be wrapped with $A.getCallback() There are similar instances across the application, please fix all of them.

 

Nisar AhmadNisar Ahmad
Remove connectedCallback and setTimeout function and use renderedCallback.

More Details 
https://lwc.dev/guide/lifecycle
https://salesforcediaries.com/2020/01/01/renderedcallback-in-lightning-web-component/
 
Megha SachaniaMegha Sachania
Thanks Nisar for your help