Skip to content

Commit

Permalink
Merge pull request ppy#29059 from frenzibyte/fix-results-fetching-twice
Browse files Browse the repository at this point in the history
Fix results screen fetching scores twice when scrolled to edge
  • Loading branch information
smoogipoo authored Aug 5, 2024
2 parents 95aab6c + 537403b commit 136cdcf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public void TestFetchWhenScrolledToTheRight()
AddAssert("right loading spinner shown", () => resultsScreen.RightSpinner.State.Value == Visibility.Visible);
waitForDisplay();

AddAssert($"count increased by {scores_per_result}", () => this.ChildrenOfType<ScorePanel>().Count() >= beforePanelCount + scores_per_result);
AddAssert($"count increased by {scores_per_result}", () => this.ChildrenOfType<ScorePanel>().Count() == beforePanelCount + scores_per_result);
AddAssert("right loading spinner hidden", () => resultsScreen.RightSpinner.State.Value == Visibility.Hidden);
}
}
Expand All @@ -156,7 +156,7 @@ public void TestNoMoreScoresToTheRight()
AddAssert("right loading spinner shown", () => resultsScreen.RightSpinner.State.Value == Visibility.Visible);
waitForDisplay();

AddAssert($"count increased by {scores_per_result}", () => this.ChildrenOfType<ScorePanel>().Count() >= beforePanelCount + scores_per_result);
AddAssert($"count increased by {scores_per_result}", () => this.ChildrenOfType<ScorePanel>().Count() == beforePanelCount + scores_per_result);
AddAssert("right loading spinner hidden", () => resultsScreen.RightSpinner.State.Value == Visibility.Hidden);

AddStep("get panel count", () => beforePanelCount = this.ChildrenOfType<ScorePanel>().Count());
Expand Down Expand Up @@ -191,7 +191,7 @@ public void TestFetchWhenScrolledToTheLeft()
AddAssert("left loading spinner shown", () => resultsScreen.LeftSpinner.State.Value == Visibility.Visible);
waitForDisplay();

AddAssert($"count increased by {scores_per_result}", () => this.ChildrenOfType<ScorePanel>().Count() >= beforePanelCount + scores_per_result);
AddAssert($"count increased by {scores_per_result}", () => this.ChildrenOfType<ScorePanel>().Count() == beforePanelCount + scores_per_result);
AddAssert("left loading spinner hidden", () => resultsScreen.LeftSpinner.State.Value == Visibility.Hidden);
}
}
Expand Down
3 changes: 2 additions & 1 deletion osu.Game/Screens/Ranking/ResultsScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ private void fetchScoresCallback(IEnumerable<ScoreInfo> scores) => Schedule(() =
foreach (var s in scores)
addScore(s);
lastFetchCompleted = true;
// allow a frame for scroll container to adjust its dimensions with the added scores before fetching again.
Schedule(() => lastFetchCompleted = true);
if (ScorePanelList.IsEmpty)
{
Expand Down

0 comments on commit 136cdcf

Please sign in to comment.