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

Update or refresh ConsoleUI mod list after repo or compat changes #3353

Merged
merged 1 commit into from
Apr 24, 2021

Conversation

HebaruSan
Copy link
Member

@HebaruSan HebaruSan commented Apr 24, 2021

Problem

If you edit your current instance's repositories in ConsoleUI, the new module list is not fetched.

If you edit your current instance's compatible versions in ConsoleUI, the mod list is not updated to reflect the new compatibility.

Cause

We refresh the mod list if you switch instances, but not otherwise.

Changes

Now if you add or remove a repo, we update the registry upon returning to the mod list.

Now if you change the compatible versions, we refresh the mod list upon returning to it.

Fixes #3352.

@HebaruSan HebaruSan added Bug Something is not working as intended Pull request Registry Issues affecting the registry ConsoleUI Issues affecting the interactive console UI labels Apr 24, 2021
@HebaruSan HebaruSan requested a review from DasSkelett April 24, 2021 00:17
@DasSkelett
Copy link
Member

Not so smart compiler:
image

I don't think we actually need GetHashCode(), since we aren't using the repositories as keys of a sorted list/dictionary/hashset anywhere (only as values). But if we want to get rid of the warning, we have to implement it.
But we could keep it a simple one. Since implementations of GetHashCode() only have to guarantee that equal objects have the same hash code, but the same hash code doesn't require the objects to be equal, and we don't rely on as few collisions as possible for performance, we could just return name.ToHashCode() and be happy.

@HebaruSan HebaruSan force-pushed the fix/consoleui-refresh branch from 2966cba to 644bf1c Compare April 24, 2021 13:03
@HebaruSan
Copy link
Member Author

OK, returning name.GetHashCode() now.

Copy link
Member

@DasSkelett DasSkelett left a comment

Choose a reason for hiding this comment

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

Thanks, works great!

@HebaruSan HebaruSan merged commit 921fe64 into KSP-CKAN:master Apr 24, 2021
@HebaruSan HebaruSan deleted the fix/consoleui-refresh branch April 24, 2021 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is not working as intended ConsoleUI Issues affecting the interactive console UI Registry Issues affecting the registry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] ConsoleUI should refresh mod list after changing compatible versions
2 participants