A developer is creating a Lightning web component that displays a list of records in a lightning-datatable. After saving a new record to the database, the list is not updating.
What should the developer change in the code above for this to happen?
A.
Add the @track decorator to the data variable.
B.
Create a new variable to store the result and annotate it with @track.
C.
Create a variable to store the result and call refreshApex().
C is correct. The "data" variable only stores the "data" part of "result". However, following the same link everyone posted here, salesforce docs clearly say that the wired function should use the entire "result" parameter in a wired function. Hence, we need to store "result" in a new variable and then call refreshApex on it.
Isn't it D? Because records is a wire function and assigns the result to this.data. So, this.data is the variable currently holding the displayed data.
upvoted 2 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
dasabhisek404
4 months, 1 week agoMarkusT
5 months, 2 weeks agoYas010101
10 months agoBrucePark
1 year, 2 months ago