Update Standard Components and Related Lists from Custom Lightning Web Component | LWC Stack ☁️⚡️

 In this blog I will teach you how to update/refresh your Standard Components and Related lists from a Custom Lightning Web Component.


In Aura we can do it like 

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

But unfortunately we can not use this directly in a custom Lightning Web Component. To use it we can use two ways - either we can have our LWC inside an AURA component and bubble up it using an custom event. Or the 2nd and the easy way is to use it with eval() in LWC Javascript. 

To implement it in your LWC you just have to use the below line in your event : 

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


This is just for refreshing the standard component, if you would like to refresh the wired list in a LWC than you should use the refreshApex for that.

For a detail explanation and a working example you may check below video tutorial.


Checkout complete video tutorial below

 If you have any question please leave a comment below.

If you would like to add something to this post please leave a comment below.
Share this blog with your friends if you find it helpful somehow !

Thanks
Happy Coding :)

Post a Comment

0 Comments