Skip to content

Commit 696aa39

Browse files
committed
fix(riot-mui): creation date from tag list was not updating on page change
1 parent d13f81c commit 696aa39

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/components/tag-list/image-date.riot

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,21 @@
2020
import { dateFormat } from '../../scripts/utils';
2121
export default {
2222
onMounted(props) {
23-
props.image.one('creation-date', (date) => {
24-
this.update({
25-
date: date,
26-
localDate: date && date.toLocaleString(),
23+
this.loadCreationDate(props);
24+
},
25+
onUpdated(props) {
26+
this.loadCreationDate(props);
27+
},
28+
loadCreationDate(props) {
29+
if (!props.image.creationDate && !props.image.ociImage) {
30+
props.image.one('creation-date', (date) => {
31+
this.update({
32+
date: date,
33+
localDate: date && date.toLocaleString(),
34+
});
2735
});
28-
});
29-
props.image.trigger('get-date');
36+
props.image.trigger('get-date');
37+
}
3038
},
3139
getDate(image) {
3240
return !image.ociImage ? `${dateFormat(image.creationDate)} ago` : 'Not Available';

0 commit comments

Comments
 (0)