-
Notifications
You must be signed in to change notification settings - Fork 209
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
Remove any-types and Mod class #1204
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have any issues from having dropped the fromReactive call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My next performance improvement branch is based on this branch, so I've been monkey testing it quite lot, and so far I've not seen any problems in (dev) building the project, errors logged in the console, or weird behaviour in the UI itself. But work on that continues so I still have more changes to observe these changes as well.
However, I'm not entirely sure in what situations should we expect the objects to get serialized and cause problems in the first place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's related to loading the profile from the mods.yml file. ManifestV2 is serialized whenever ProfileModList is called to save, and is deserialized whenever we load the contents again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably good to double check, and if it does prove to still be a potential issue, in my opinion the proper deserialization should simply be moved to be a part of the loading process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this should not be an issue, the source of the data seems to all trace back to
ProfileModList.getModList
which also instantiates a proper object for it rather than just passing in the values. This change just simply adds the proper type annotation here and in doing so makes it apparent that theMod
class is not actually needed anymore.It is possible that the vuex state somehow ends up containing something other than it's annotated to do without our current TS configuration catching it (or e.g. due to type casting that should not be done somewhere), but I couldn't find any such code at least (as mentioned, most seems to originate from
ProfileModList.getModList
, or alternatively some of the mutation operations in the same module)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright so the main difference here is that the
Mod.fromReactive
implementation uses the actual package manifest.json for populating the values, whereas theProfileModList.getModList
uses whatever happens to be populated in themods.yml
. In a sense theMod.fromReactive
implementation behaves more "correctly" in this case as it's actually using the data provided by the package itself rather than a state cache file.In practice I'm not sure if it matters, but I do think the correct way to load mod metadata is to read it from said mod's own manifest file. I suppose the changes in this PR are still an improvement because it's better to have the metadata parsing be consistent and predictable, which is being achieved by removing the rarely used alternative metadata parsing.