0

Recently I build a custom related list component.

As we know in related list we always have some navigate lookup fields and the "view all" button which will cause a navigation.

So in my custom component, I also create the navigation field with <lightning-formatted-url> and <a> tag.

But I find out that in standard, after I clicking the "view all" button or a lookup field which cause a navigation, and click "back" button in browser, the previous page will show immediately.

However, In my custom lwc component, If I clicked the either lightning-formatted-url or <a> tag, and click back again, the whole previous page will be refreshed, and all the data/components are loading again.

It is like in standard related list, the previous page is cached, clicking back button will redirect to the cached page which doesn't need loading anymore. In custom component, the previous page is lost and need to be loaded again. Is this some ajax behavior or anything I didn't know?

For a best UE(user experience), I really appreciate it if anyone can give me some advice.

If you need more infomation, please leave a comment, I will update any info I can provide.

3
  • Or is it a One-Page-Application behavior? How can I accomplish the same feature? – Lanjinest Dec 23 '20 at 2:40
  • For navigation salesforce internally might have used router services, you can try using navigation apis lightning/navigation instead of passing <a> / lightning-formatted-url tag. That should use the same navigation logic which lightning uses internally. – Nagendra Singh Dec 23 '20 at 2:59
  • this is a doable way, I tried and the behavior is now the same, leave an answer an I'll select your answer. – Lanjinest Dec 23 '20 at 8:10
0

For navigation salesforce internally might have used router services, you can try using navigation apis lightning/navigation instead of passing <a> / lightning-formatted-url tag.

That should use the same navigation logic which lightning uses internally.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.