Skip to content
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

Fix sorting online mod list by download counts #1517

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

anttimaki
Copy link
Collaborator

This had broken when ThunderstoreMod object dropped a reference to a list of ThunderstoreVersions to reduce memory usage. ThunderstoreMod defined a separate getter for package's total download count, but the sorting method kept using the getter inherited by ThunderstoreMod from ThunderstoreVersion, always returning 0. TypeScript didn't catch the error, since due to inheritance, it was a valid getter to call.

Rather than rename the sorting method to use the correct getter, drop the duplicate getter to ensure similar errors don't occur in the future. Both ThunderstoreMod and ThunderstoreVersion now have the same getter, while former just returns the combined download counts of all the versions.

This had broken when ThunderstoreMod object dropped a reference to a
list of ThunderstoreVersions to reduce memory usage. ThunderstoreMod
defined a separate getter for package's total download count, but the
sorting method kept using the getter inherited by ThunderstoreMod from
ThunderstoreVersion, always returning 0. TypeScript didn't catch the
error, since due to inheritance, it was a valid getter to call.

Rather than rename the sorting method to use the correct getter, drop
the duplicate getter to ensure similar errors don't occur in the
future. Both ThunderstoreMod and ThunderstoreVersion now have the same
getter, while former just returns the combined download counts of all
the versions.
Copy link
Collaborator

@VilppeRiskidev VilppeRiskidev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! 👍

@anttimaki anttimaki merged commit 6526373 into develop Nov 4, 2024
5 checks passed
@anttimaki anttimaki deleted the fix-sort-by-downloads branch November 4, 2024 10:36
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

Successfully merging this pull request may close these issues.

2 participants