I have a unique table where I showcase details about a particular website. Among the displayed information is the timestamp indicating when the data was last updated.
At the top of the table, my aim is to include an icon that will only appear if the duration between now and the last data refresh exceeds 5 minutes. Furthermore, I desire for this time display to automatically update without necessitating a page refresh from the user.
In order to implement this functionality, I incorporated a specific component within my Vue.js code.
computed () {
getMinutesPassedSinceLastRefresh () {
if (moment(this.currentTime).diff(this.lastRefreshTime, 'minutes') >= 5) {
return moment(this.currentTime).diff(this.lastRefreshTime, 'minutes')
}
}
}
This function calculates the number of minutes elapsed since the data was last refreshed up to the present time. Nevertheless, the data does not dynamically update by itself; instead, it requires either a manual page refresh or switching tabs for it to reflect the latest information.
Do you have any creative solutions on how this issue can be resolved?