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

Continue refactoring ProfileImportModal to eventually separate business logic from UI #1477

Open
wants to merge 10 commits into
base: immutable-profile-pt6-profileinstallprovider-install
Choose a base branch
from

Commits on Oct 9, 2024

  1. installProfileHandler: sanity check state before proceeding

    Avoid unnecessary non-null assertions as that's a bad habit. Throw an
    error if components local state is invalid before starting the import.
    anttimaki committed Oct 9, 2024
    Configuration menu
    Copy the full SHA
    cd39266 View commit details
    Browse the repository at this point in the history
  2. Simplify arguments of profileCreatedCallback

    This makes the code easier to read and might make it easier to refactor
    the profileCreatedCallback further.
    anttimaki committed Oct 9, 2024
    Configuration menu
    Copy the full SHA
    14d4c08 View commit details
    Browse the repository at this point in the history
  3. Drop checking file extension when extracting imported profile

    Profiles imported as code are always .r2z files. Previously user could
    choose the older .r2x format when importing profile from a file, but
    support for this was dropped recently, and only .r2z is supported now.
    anttimaki committed Oct 9, 2024
    Configuration menu
    Copy the full SHA
    8a047b5 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    2431010 View commit details
    Browse the repository at this point in the history
  5. profileCreatedCallback: reduce nesting by checking error state earlier

    As a bonus this now handless the unlikely error properly instead of
    just ignoring it silently.
    anttimaki committed Oct 9, 2024
    Configuration menu
    Copy the full SHA
    8435e8e View commit details
    Browse the repository at this point in the history
  6. profileCreatedCallback: reduce nesting by making the method async

    This requires slight changes to addEventListener, but these changes are
    probably an improvements by themselves.
    anttimaki committed Oct 9, 2024
    Configuration menu
    Copy the full SHA
    8755f0c View commit details
    Browse the repository at this point in the history
  7. profileCreatedCallback: reduce nesting by removing unnecessary check

    - Earlier step has checked there's importable mods in the profile
    - Download provider has another, less user-friendly check for the same
      thing to prevent the mod profile from getting stuck
    - It doesn't seem anything catastrophic would happen even if the rest
      of the code is executed using an empty mod list
    anttimaki committed Oct 9, 2024
    Configuration menu
    Copy the full SHA
    d386f47 View commit details
    Browse the repository at this point in the history
  8. profileCreatedCallback: reduce nesting by removing setTimeout

    I don't see any reason for to wrap the code in the timeout. This might
    have been relevant when the import step was started right away after a
    new profile was created, by there now exists a preview window between
    these steps so the folder should always exists. If it doesn't, the
    100ms wait won't change things.
    anttimaki committed Oct 9, 2024
    Configuration menu
    Copy the full SHA
    444fdf6 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    adac1f5 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    612d010 View commit details
    Browse the repository at this point in the history