How to make the @AuraEnabled(cacheable=true) and wire method work properly when there is an issue with @AuraEnabled(cacheable=true)?

306    Asked by DianeCarr in Salesforce , Asked on Aug 23, 2023

Earlier, I had a wire method and an apex method called @AuraEnabled(cacheable=true) in LWC. But after a little experiment with the @AuraEnabled(cacheable=true), the Apex is run by the LWC. I tried to refresh, close the browser and set it black to cacheable=true. But nothing worked. How can I go back to the previous position? 

Answered by Diana Campbell

Since the wire adaptor uses browser cache to store any kind of data from wire, as a default behavior, apex methods that are to be cached must be marked as @AuraEnabled(cacheable=true) become @AuraEnabled(cacheable=fasle), making the wire adaptor unable to call the apex method. That is why LWC does not accept the apex method and refuses to run.



Your Answer

Interviews

Parent Categories