then(() => {
this.dispatchEvent(
new ShowToastEvent({
title: 'Success',
message: 'Record Is Updated',
variant: 'Success',
}),
); location.reload();
})
.catch(error => {
this.dispatchEvent(
new ShowToastEvent({
title: 'Error on data save',
message: error,
variant: 'error',
}),
);
});
Sent from Yahoo Mail on Android
Did you get my point, am using LWC as a component to update some fields after clicking update the values are updated in databse and it is navigated to Detail page but the detail page UI is not reflected with updated values, they are reflected once we refresh the page.
Where should I use location.reload(); am using below standard Updaterecord function which automaltically navigates to Detail Page. updateRecord(record) // eslint-disable-next-line no-unused-vars .then(() => { this.dispatchEvent( new ShowToastEvent({ title: 'Success', message: 'Record Is Updated', variant: 'Success', }), ); }) .catch(error => { this.dispatchEvent( new ShowToastEvent({ title: 'Error on data save', message: error, variant: 'error', }), ); });
then(() => {
this.dispatchEvent(
new ShowToastEvent({
title: 'Success',
message: 'Record Is Updated',
variant: 'Success',
}),
); location.reload();
})
.catch(error => {
this.dispatchEvent(
new ShowToastEvent({
title: 'Error on data save',
message: error,
variant: 'error',
}),
);
});
Sent from Yahoo Mail on Android
All Answers
Please check the data you are showing is marked with @track modifier
The data is updated in database, but it is not reflecting on UI.
Did you get my point, am using LWC as a component to update some fields after clicking update the values are updated in databse and it is navigated to Detail page but the detail page UI is not reflected with updated values, they are reflected once we refresh the page.
Please use location.reload(); to reload the page.
am using below standard Updaterecord function which automaltically navigates to Detail Page.
updateRecord(record)
// eslint-disable-next-line no-unused-vars
.then(() => {
this.dispatchEvent(
new ShowToastEvent({
title: 'Success',
message: 'Record Is Updated',
variant: 'Success',
}),
);
})
.catch(error => {
this.dispatchEvent(
new ShowToastEvent({
title: 'Error on data save',
message: error,
variant: 'error',
}),
);
});
i am facing some awkward issue in LWC, for the very first time when I am using LWC component to update the records it throws below error
![Attached image](/api/3/files/20914771/preview/image-1586948929204.png)
i am facing some awkward issue in LWC, for the very first time when I am using LWC component to update the records it throws below error
Please check the console.log for better view of the error, it is going inside catch statement. something is failing at the apex end.