Update onUpdateWatched to update a subset of videos.

This commit is contained in:
Chris Hallberg 2022-10-22 16:24:56 -04:00
parent ae460bbcde
commit c4d3e4a7a2
2 changed files with 10 additions and 4 deletions

View file

@ -91,8 +91,14 @@ export default {
this.loadMoreVideos();
}
},
onUpdateWatched() {
onUpdateWatched(urls = null) {
if (urls === null) {
if (this.videos.length > 0) this.updateWatched(this.videos);
return;
}
const subset = this.videos.filter(({ url }) => urls.includes(url));
if (subset.length > 0) this.updateWatched(subset);
},
},
};

View file

@ -206,7 +206,7 @@ export default {
if (this.video.watched) {
let request = store.delete(videoId);
request.onsuccess = function () {
instance.$emit("update:watched");
instance.$emit("update:watched", [instance.video.url]);
};
return;
}
@ -233,7 +233,7 @@ export default {
// Save
store.put(video);
// Disappear if hideWatched is on
instance.$emit("update:watched");
instance.$emit("update:watched", [instance.video.url]);
instance.shouldShowVideo();
};
}