I suppose there are two pages in Communities namely, Page A and Page B. Page A has an LWC component which has @wire method. This wire method gets the Account details of the particular user. The wire method is as follows:
@wire(getAccountOfUser, {userId: '$userId'})
wiredAccount(result) {
this.accountData = result;
const {data,error} = result;
if(data) {
this.acct = JSON.parse(data);
this.error = undefined
else if(error) {
this.acct = undefined;
this.error = error;
}
When I go from Page A to Page B and if there is an update in Account details, the account details are getting updated in the back-end. Whereas, if i come back to page A, the above wire method is not fetching the updated Account details and getting the data that was there before updating. What should I have to do? I have tried refreshing apex in page reference and also in the connected callback. None of them seems to work. It's working well when i put refresh apex in the rendered callback and I don't like refreshing Apex in the rendered callback.
Is there any specific reason why this is happening? Or is there any workaround to get the latest account details data whenever the page is getting loaded?