Skip to content

Commit d18c33d

Browse files
authored
feature: watch highlights open on all time when this week has no plays (#733)
1 parent 8d51d0d commit d18c33d

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

‎components/watch/WatchHighlights.vue‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ function clipsWhere() {
8181
return where;
8282
}
8383
84+
// A quiet week opens on all time rather than an empty grid.
85+
let widenOnEmpty = true;
86+
8487
let requestId = 0;
8588
async function fetchClips() {
8689
if (props.ghost) return;
@@ -102,7 +105,14 @@ async function fetchClips() {
102105
fetchPolicy: "network-only",
103106
});
104107
if (id !== requestId) return;
105-
clips.value = ((data as any)?.match_clips ?? []) as Clip[];
108+
const list = ((data as any)?.match_clips ?? []) as Clip[];
109+
if (widenOnEmpty && list.length === 0 && range.value === "week") {
110+
widenOnEmpty = false;
111+
range.value = "all";
112+
return;
113+
}
114+
widenOnEmpty = false;
115+
clips.value = list;
106116
} catch (error) {
107117
console.error("[watch] highlights fetch error:", error);
108118
} finally {

0 commit comments

Comments
 (0)