Skip to content

Commit ae0405e

Browse files
authored
Merge pull request #11968 from nanaya/discussion-no-beatmap
Fix discussion page error with no visible beatmap
2 parents 5e71d23 + 9ba3869 commit ae0405e

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

resources/js/stores/beatmapset-discussions-show-store.ts

+10-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,16 @@ export default class BeatmapsetDiscussionsShowStore implements BeatmapsetDiscuss
1919
}
2020
}
2121

22-
return mapBy(
23-
this.beatmapset.beatmaps.filter((beatmap) => beatmap.deleted_at == null || hasDiscussion.has(beatmap.id)),
24-
'id',
25-
);
22+
let visibleBeatmaps = this
23+
.beatmapset
24+
.beatmaps
25+
.filter((beatmap) => beatmap.deleted_at == null || hasDiscussion.has(beatmap.id));
26+
27+
if (visibleBeatmaps.length === 0) {
28+
visibleBeatmaps = [this.beatmapset.beatmaps[0]];
29+
}
30+
31+
return mapBy(visibleBeatmaps, 'id');
2632
}
2733

2834
@computed

0 commit comments

Comments
 (0)