function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shuhbam SinhaShuhbam Sinha 

Refresh LWC component

Hello,
I  have a LWC component which shows list of records . I am fetching the records from apex with WIRE decorator if a case staus is 'New'. Now if I change the status to New to Close , I still can see the data. I have to manually  refresh the data to make it disappear. I want as soon I change the status from new to close at that time the LWC should auto refresh. 
Please help me on this. Thanks in advance.
P.S. - I am updating the status from Case's standard UI.
AnkaiahAnkaiah (Salesforce Developers) 
Hi Shubham,

Refer the below link will help you to fix your issue.
https://salesforce.stackexchange.com/questions/354823/lwc-lightning-datatable-not-refreshing-when-data-changes

If this helps, Please mark it as best answer.

Thanks!!
TobyKutlerTobyKutler
You can use the refresh Apex method. Here is an example of its use taken from another support forum: 
 
import { LightningElement, wire, track } from 'lwc';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import findSomething from '@salesforce/apex/ApexController.findMethod';
import changeSomething from '@salesforce/apex/ApexController.changeMethod';
//important the refresh apex method
import {refreshApex} from '@salesforce/apex';

findSomething
changeSomething
@track paramForChangeOne
@track paramForChangeTwo

@wire(findSomething, { paramOne: '$paramOne', paramTwo: '$paramTwo' }) findSomething;

callFromHtml(){
        changeSomething({paramForChangeOne: this.paramForChangeOne, paramForChangeTwo: this.paramForChangeTwo})
        .then(result => {
            if(result){
                this.showNotification('success', 'Success Message', '');
            }
            // refreshing table data using refresh apex
            refreshApex(this.findSomething);
        })
        .catch(error => {
            console.log(error);
        });
    }