Skip to main content
added 579 characters in body
Source Link
joacoiudica
  • 1k
  • 2
  • 12
  • 40

So, I have a lwc component, that is accessed via related list. When I enter the record page, and navigate to the lwc, everything works fine. Then, if I do something on that lwc, save and navigate back to the record page (via navigation mixin) and then, go back to the lwc, it loads the last thing I saw before saving, with the old values, and does not refresh it. Is there a way to force the lwc component to refresh everytime I navigate to it? I understand refreshing the whole page is not good for the user experience. Is there a formal way Salesforce provides?

EDIT: I forgot to mention, my LWC is wrapped around an url addressable aura component. I found this in the query parameters documentation:

"If your component uses the lightning:hasPageReference or lightning:isUrlAddressable interfaces, always implement a change handler. When the target of a navigation action maps to the same component, the routing container might simply update the pageReference attribute value instead of recreating the component. In this scenario, a change handler ensures that your component reacts correctly." does that have something to do with it?

So, I have a lwc component, that is accessed via related list. When I enter the record page, and navigate to the lwc, everything works fine. Then, if I do something on that lwc, save and navigate back to the record page (via navigation mixin) and then, go back to the lwc, it loads the last thing I saw before saving, with the old values, and does not refresh it. Is there a way to force the lwc component to refresh everytime I navigate to it? I understand refreshing the whole page is not good for the user experience. Is there a formal way Salesforce provides?

So, I have a lwc component, that is accessed via related list. When I enter the record page, and navigate to the lwc, everything works fine. Then, if I do something on that lwc, save and navigate back to the record page (via navigation mixin) and then, go back to the lwc, it loads the last thing I saw before saving, with the old values, and does not refresh it. Is there a way to force the lwc component to refresh everytime I navigate to it? I understand refreshing the whole page is not good for the user experience. Is there a formal way Salesforce provides?

EDIT: I forgot to mention, my LWC is wrapped around an url addressable aura component. I found this in the query parameters documentation:

"If your component uses the lightning:hasPageReference or lightning:isUrlAddressable interfaces, always implement a change handler. When the target of a navigation action maps to the same component, the routing container might simply update the pageReference attribute value instead of recreating the component. In this scenario, a change handler ensures that your component reacts correctly." does that have something to do with it?

Source Link
joacoiudica
  • 1k
  • 2
  • 12
  • 40

lwc component does not refresh when navigating back to it from record page

So, I have a lwc component, that is accessed via related list. When I enter the record page, and navigate to the lwc, everything works fine. Then, if I do something on that lwc, save and navigate back to the record page (via navigation mixin) and then, go back to the lwc, it loads the last thing I saw before saving, with the old values, and does not refresh it. Is there a way to force the lwc component to refresh everytime I navigate to it? I understand refreshing the whole page is not good for the user experience. Is there a formal way Salesforce provides?