+ Start a Discussion
Agnibha Chakrabarti 10Agnibha Chakrabarti 10 

i dont want to cache the data in client side

i found that i cant use @wire without setting cacheable=true.  But i dont want to cache the data... is there any solution?
Puneet_MishraPuneet_Mishra
yes, call you method from your LWC in get set methods or in connectedCallback
Gian Piere VallejosGian Piere Vallejos
In javascript file.
import connectToMethod from '@salesforce/apex/lwcController.methodToCall'

@wire(connectToMethod, {recordId: '$recordId'})
    wiredData({error, data}){
        if( data ) {
            //Data handle
        }else{            
            //Error handle
        }
    }
In apex lwcController.cls create the method:
@AuraEnabled
public static Object methodToCall(String recordId){
    //Code
}