0

I have LWC component tab "DealSearch" to search the records based on "searchstring". After getting search result on DealSearch tab, I am switching from the LWC tab to another tab eg:- Account, then again coming back to DealSearch. Instead of refreshing the page, I am seeing the old data on my LWC tab.

6
  • Are you using your LWC tab on the record page? can you share some code? – Klecool Sep 4 '20 at 6:29
  • <?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="soap.sforce.com/2006/04/metadata"> <apiVersion>48.0</apiVersion> <isExposed>true</isExposed> <targets> <target> lightning__Tab </target> </targets> </LightningComponentBundle> – Moni Jaiswal Sep 4 '20 at 6:38
  • Only exposed to tab and using it in my custom tab – Moni Jaiswal Sep 4 '20 at 6:38
  • directly added my LWC component bundle to Lightning tab and created "DealSearch" custom tab. – Moni Jaiswal Sep 4 '20 at 6:41
  • It seems we should not directly create tab with LWC component bundle, otherwise this refresh issue will persist, thanks. – Moni Jaiswal Sep 4 '20 at 11:46
0

You need to create Aura Component and put your LWC component inside that aura component. For custom tab, use the aura component.(code reference)

<aura:component implements="force:appHostable"> <c:LwcComponent/> </aura:component>

0

after search result you can use this code to refresh.

eval("$A.get('e.force:refreshView').fire();");

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.