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

Refactor LocalModList search/sort #1202

Merged
merged 7 commits into from
Feb 15, 2024
Merged

Refactor LocalModList search/sort #1202

merged 7 commits into from
Feb 15, 2024

Conversation

anttimaki
Copy link
Collaborator

No description provided.

@ebkr ebkr marked this pull request as ready for review February 14, 2024 09:08
Copy link
Collaborator

@MythicManiac MythicManiac left a comment

Choose a reason for hiding this comment

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

Calling the new VueX store module the ProfileModule is a bit misleading IMO given that it primarily is concerned with the local mod list search & sort functionality.

I'm also assuming there's a reason you didn't move the settings updating code to the vuex store yet (perhaps due to the current game/settings not being as easily accessible there) so I don't mind if this version of the code gets merged as is; those concerns can be addressed later / aren't blockers.

So overall this looks good to me 👍

Comment on lines 18 to 20
emitChange() {
this.$emit('changed', this.internalValue);
this.$emit('change', this.internalValue);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this actually needed anymore now that the model binding is used?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it's still needed to convey the changes to the internalValue to the external value.

Comment on lines +23 to +24
this.$store.commit('profile/setOrder', value);
this.settings.setInstalledSortBy(value);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I feel like the setting value change should be handled by the store rather than this component?

Comment on lines +32 to +33
this.$store.commit('profile/setDirection', value);
this.settings.setInstalledSortDirection(value);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Likewise here, shouldn't the store be the primary "API" for making these changes, and as such take care of syncing the state to where it should get synced?

Alternatively, the settings could subscribe itself to track the profile store I suppose.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As per Discord discussions, to make this change properly we'd need to also have the active game and profile available in Vuex. That and these changes are now on my todo list but meanwhile I won't block these changes.

Comment on lines +41 to +42
this.$store.commit('profile/setDisabledPosition', value);
this.settings.setInstalledDisablePosition(value);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above

This is foundational work for other changes that aim to improve
performance by continuing to split LocalModList to smaller components.
The original implementation didn't support passing initial values to
the input. This is required i.e. when the value should match value
stored in VueX
Extract the search bar functionality from LocalModList to standalone
component. Unfortunately this yielded no performance benefits.
Previously modifiableModList was used. It was derived from localModList
by sorting it. However, one of the sort options allows hiding disabled
mods, meaning that the list might be missing an arbitrary number of
mods.

Instead use localModList which is guaranteed to include all the
dependencies/dependants. This will change the functionality a bit by
possibly changing the order of mods returned by methods that return
lists of dependencies and dependants. Given how these results are used,
I *assume* it won't matter that much for the rest of the functionality
(since the order could already be quite arbitrary) or the user.
Now that a separate orderedModList is no longer needed, we might as
well combine the ordering and filtering into the same method, and do
the fiiltering first to speed up ordering when searchQuery is used.
}

async destroyed() {
this.$store.commit('profile/setSearchQuery', '');
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added this so the search query gets cleared when the component is unmounted, to match the existing functionality.

@anttimaki anttimaki merged commit 9c2b206 into develop Feb 15, 2024
7 checks passed
@anttimaki anttimaki deleted the mod-list-sort branch February 15, 2024 10:27
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