0

enter image description here

I have a component like the above where using Edit Page, I have created a new Email tab, and I have added an LWC component. I am looking for a way such that whenever I click this Email tab, the component starts loading and rendering data.

So right now when I click the Email tab for the first time, the LWC component is rendered for the 1st time. But if I click on any other tab and click the Email tab again, I see the same rendered component.

Is there any event using which I can get to know when to reload the component? Or is it possible to call disconnectedCallback when this component is not visible?

1 Answer 1

0

This is a feature of how Lightning Experience works. It does not render components before they are shown, and it does not immediately remove components when they are no longer shown. This improves UI performance considerably. You can make your component context-aware, such that it can load/reload a record when an edit is made, but beyond that, there's no reliable way to detect when the user has navigated away from/into a tab.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .