8000 "Show More" button is incorrectly displayed when item count equals InitialItemsCount · Issue #33069 · ppy/osu · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

"Show More" button is incorrectly displayed when item count equals InitialItemsCount #33069

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ohdj opened this issue May 8, 2025 · 0 comments

Comments

@ohdj
Copy link
Contributor
ohdj commented May 8, 2025

Type

Cosmetic

Bug description

English is not my first language, so I've used machine translation to help write this :(

In the game's player info page, lists default to displaying 5 items. If there are more than 5 items, a SHOW MORE button appears, which can be clicked to load more. (For Beatmaps-related content, this is 6 items, and for Graveyarded Beatmaps, it's 2 items).

protected virtual int InitialItemsCount => 5;

protected override int InitialItemsCount => type == BeatmapSetType.Graveyard ? 2 : 6;

In Lazer, if the number of items loaded is exactly equal to the InitialItemsCount (e.g. when a user's 'Recent Plays' has exactly 5 items, or 'Favorite Beatmaps' has exactly 6 items as per the screenshots), the Show More button is incorrectly displayed.

Image

Image

While on the osu! website, the button would be correctly hidden under the same circumstances.

Image

Even when the button is clicked, it stays visible and gets stuck in the loading state.

image

The issue is in the following code:

protected virtual void UpdateItems(List<TModel> items, CancellationTokenSource cancellationTokenSource) => Schedule(() =>
{
OnItemsReceived(items);
if (!items.Any() && CurrentPage?.Offset == 0)
{
moreButton.Hide();
moreButton.IsLoading = false;
if (missingText.HasValue)
missing.Show();
return;
}
LoadComponentsAsync(items.Select(CreateDrawableItem).Where(d => d != null).Cast<Drawable>(), drawables =>
{
missing.Hide();
moreButton.FadeTo(items.Count == CurrentPage?.Limit ? 1 : 0);
moreButton.IsLoading = false;
ItemsContainer.AddRange(drawables);
}, cancellationTokenSource.Token);
});

Some ideas I've explored:

  1. This at least makes the incorrectly shown button disappear after being clicked, but doesn't prevent it from showing up wrongly in the first place.

if (!items.Any() && CurrentPage?.Offset == 0)

// even if the "Show More" button is incorrectly displayed, clicking it will at least make it disappear.
- if (!items.Any() && CurrentPage?.Offset == 0)
+ if (!items.Any())
  1. This approach seems closer to addressing the root cause. It relies on accessing the total count stored in header.Current.Value from the ProfileSubsection class. It need to be changed header accessible from private to protected.

private ProfileSubsectionHeader header = null!;

private ProfileSubsectionHeader header = null!; 
+ protected int TotalCount => header.Current.Value;

I'm not sure if this is appropriate? If I directly changing header to protected triggers a naming convention warning: "Name 'header' does not match rule 'public_members_pascalcase'. Suggested name is 'Header'. So I tried adding a new protected property.

Image

moreButton.FadeTo(items.Count == CurrentPage?.Limit ? 1 : 0);

- moreButton.FadeTo(items.Count == CurrentPage?.Limit ? 1 : 0);
+ moreButton.FadeTo(items.Count == CurrentPage?.Limit && items.Count != TotalCount ? 1 : 0);
(or)
// instead of adding an extra protected property, if you directly make header protected, use this
+ moreButton.FadeTo(items.Count == CurrentPage?.Limit && items.Count != header.Current.Value ? 1 : 0);

I'm not entirely sure which modification would best align with the project's coding style and design patterns. If there's a clear direction for a solution, I'd be happy to submit a Pull Request to help fix this issue.

Screenshots or videos

protected virtual int InitialItemsCount => 5;

protected override int InitialItemsCount => type == BeatmapSetType.Graveyard ? 2 : 6;

Graveyarded Beatmaps = 2
osu! website image
osu! Lazer osu_2024-07-22_14-41-37
Recent Plays (24h) = 5 & Favourite Beatmaps = 6
osu! website image
osu! Lazer osu_2024-07-22_14-47-03
Pending Beatmaps = 6
osu! website image
osu! Lazer osu_2024-07-22_14-38-40

Version

Lazer 2025.424.0

Logs

N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0