Skip to content

UI/UX Optimizations, Code Quality Enhancements, Deploy UI, and Mod Importing Improvements#958

Open
vthiep2412 wants to merge 13 commits into
atampy25:mainfrom
vthiep2412:main
Open

UI/UX Optimizations, Code Quality Enhancements, Deploy UI, and Mod Importing Improvements#958
vthiep2412 wants to merge 13 commits into
atampy25:mainfrom
vthiep2412:main

Conversation

@vthiep2412

@vthiep2412 vthiep2412 commented Jul 5, 2026

Copy link
Copy Markdown

UI/UX Optimization

  • Render inline loading states and tips during page navigation in layout view.
  • Cache GitHub release checks and mod update checks using localStorage to avoid rate limits for the API.
  • Remove obsolete page reloads to leverage Svelte routing.
  • Patch manifestsMap in-memory directly during setModManifest to prevent synchronous disk rescans.
  • Add safe option checks in sortMods to prevent page crashes when option arrays are undefined.
  • Group missing mods validation into a single startup alert dialog and filter them from the load order.

Cache Optimization

  • Implement double-buffered cache preloading for mod manifests, folders, and framework checks in utils.ts.
  • Replace synchronous memoized file reads with asynchronous cache checks.
  • Replace many synchronous actions with asynchronous ones to prevent UI freeze.
  • Preload and cache mod folders and manifests in memory to avoid slow disk reads during UI rendering.
  • Selectively invalidate validation cache per folder during imports and updates.

Code Quality / Security Improvements

  • Limit chunk extraction regex matching to file basenames or relative subpaths to prevent directory name conflicts.
  • Sanitize folder names in sanitizeModName by stripping Windows-invalid filename characters and dot segments.
  • Generate a validation cache key based on the stats of all validation-critical files and cache the "No manifest" state.
  • Track the active 7-Zip process handle in Svelte and kill the process when the user cancels staging.
  • Kill rpkg-cli.exe using taskkill when a deployment fails to clean up orphaned worker processes.
  • Tighten download security by:
    • Requiring the HTTPS protocol.
    • Enforce strict hostname validation against the trusted hosts list instead of allowing all github.io subdomains.
  • Fix HTML markup inside the delete modal by moving the progress bar container out of the paragraph tags.
  • Implement safe swap and rollback for mod updates.

Mod Importing and Management

  • Add a staging container for bulk mod archives with validation checks on the mod list page.
  • Enable multi-selection in the file open dialog within the Electron backend.
  • Support folder naming for custom RPKG mods during staging.
  • Make mod import and delete operations run asynchronously.
  • Bind dialogs to the main window to ensure proper modal focus.
  • (Dev Env) Ignore staging and temp directories in electron-reloader to prevent page reloads.

Deploy UI

  • Adjust the font size and output console size for better visuals.
  • Add Elapsed High Performance time, persistent even if the GUI crashes.
    • If the deploy is successful, it will show “Done in…”, and if it fails, it will show “Failed in…”.
    • Note: Elapse is a custom timer by the frontend and has a higher precision than the backend timer. "Done in…" by the frontend will differ from the backend because Node.js overhead is incurred on the backend.
  • Add Smart Scroll to console: pause auto-scroll on manual scroll up and resume after random idle delay (15s to 25s) or on scroll back to bottom.
  • Add percentage tracking and a progress bar based on the percentage.
    • 0% to 10% is for Discovering mods.
    • 10% to 30% is for Analysing framework mod.
    • 30% to 90% is for Deploying and Applying patch.
    • 90% to 100% is for:
      • Localizing text
      • Patching thumbs
      • Patching packagedefinition
      • Generating RPKGs
  • Add a filter for duplicate output to the console.
  • Moved the warning block to the side to display multiple warnings easily, utilizing set to prevent duplicate warnings.
    • Added the total warning count, and each warning is numbered in the format [xx].
  • Implement an incremental console log parser with a throttled 200ms update frequency to prevent UI lag and improve I/O
  • Added console vertical resize for better inspection/debugging errors.

Notes

  • I added a lot of build artifacts to .gitignore during testing and debugging.
  • I added a crash bypass on launch of Mod Manager when Deploy.exe is absent in the developer environment.
  • This is my first-ever PR on a public project/repo, so I welcome any feedback, suggestions, or corrections during the code review process. (please go easy on me :) )

Optimize mod cache performance using double buffering and asynchronous file reads. Add bulk mod staging and verification to the mod list manager. Use localStorage to cache update checks and display loading indicators during page navigation.

Cache optimization
- Implement double-buffered cache preloading for mod manifests, folders, and framework checks in utils
- Replace synchronous memoized file reads with asynchronous cache checks

Mod importing and management
- Add a staging container for bulk mod archives with validation checks in mod list page
- Support folder naming for custom RPKG mods during staging

UI performance
- Render inline loading states and tips during page navigation in layout view
- Cache GitHub release checks and mod update checks using localStorage to avoid rate limits
- Remove obsolete page-reloads to leverage Svelte routing smoothly

Platform and build integration
- Avoid hard crash on launch when Deploy exe is absent in development mode
- Enable multi-selection in file open dialog within electron backend
- Append build artifacts to gitignore and disable server-side rendering for SvelteKit
… Deploy UI

## UI/UX optimization
 - Increase the loading speed of ModList, Settings page.
 - Refactor page caching, allowing for faster page load after cache.
 - Group missing mods validation into a single startup alert dialog and filter them from the load order.
 - Preload and cache mod folders and manifests in memory to avoid slow disk reads during UI rendering.
 - Wrap preloadModsCache calls in Svelte page mount with try/catch/finally to prevent infinite loading spinners.
 - Patch manifestsMap in-memory directly during setModManifest to prevent synchronous disk rescans.
 - Add safe options checks in sortMods to prevent page crashes when option arrays are undefined.

## Code quality
 - Limit chunk extraction regex matching to file basenames or relative subpaths to prevent directory name conflicts.
 - Sanitize folder names in sanitizeModName by stripping Windows-invalid filename characters and dot segments.
 - Generate a validation cache key based on the stats of all validation-critical files and cache the "No manifest" state.
 - Track the active 7-Zip process handle in Svelte and kill the process when the user cancels staging.
 - Kill rpkg-cli.exe using taskkill when a deployment fails to clean up orphaned worker processes.

## Improve Deploy UI
 - Adjust the font size and output console size for a better visual.
 - Add Elapsed High Performance time, persistent even if the GUI crashes.
     - If the deploy is successful, it will show “Done in…”; If it fails, it will show “Failed in…”.
     - Note: Elapse is a custom timer by the frontend and has a higher precision than the backend timer. So “Done in…” by the frontend will differ from the backend because Node.Js overhead is incurred on the backend.
 - Add Smart scroll to console: pause auto-scroll on manual scroll up and resume after random idle delay (15s to 25s) or on scroll back to bottom.
 - Add percentage and a progress bar based on the percentage.
     - 0% to 10% is for Discovering mods.
     - 10% to 30% is for Analysing framework mod.
     - 30% to 90% is for Deploying and Applying patch.
     - 90% to 100% is for:
         - Localising text
         - Patching thumbs
         - Patching packagedefinition
         - Generating RPKGs
 - Add a filter for duplicate output to the console.
 - The warning block has been moved to the side to display multiple warnings more easily, and it uses `set` to prevent duplicate warnings.
… issues

- Remove duplicate flags from child_process spawn for Deploy.exe
- Implement robust error handling on deployProcess to prevent stuck state
- Make mod validation reactive and eliminate mounting flicker
- Evict older validation cache entries in localStorage to prevent key accumulation
- Default config.loadOrder to empty array if missing
- centralize trustedHosts allowlist and require HTTPS protocol for updates
- Wrap preload cache calls and manifest lookups in try-catch on authoring pages
- Add single cleanup path and single-fire guard for deploy process setup
- Kill partially started child process to prevent process leaks
- Defer expensive filesystem validation checks using setTimeout to improve initial paint performance
…timize deploy process

- Move cache state variables to the top of utils.ts to resolve used-before-defined warnings
- Convert mutable let exports to getter functions to prevent ES module mutable binding issues
- Silence unused variable warning on the dummy Svelte reactivity helper parameter using a void statement
- Specify type-safe unknown instead of any for directory removal error reference
- Add skipcq directives to bypass cyclomatic complexity check on performValidation
- Safely type options mapping functions in validation helpers to prevent runtime errors
- Fix typo in platform check inside main.ts by remove `as any`, idk why it like that but I follow linter.
- Adjust Warnings container width to a stable 260px inline style on the modList page
- Expand deploy modal container width to 56% on screens wider than 82rem
- Hide the deployment failure duration label if the duration is 5s or less
- Replace empty catch blocks with clean parameterless catch declarations
- Check Deploy.exe exit codes on close to report crashed or terminated deployments to the UI
- Secure download validation by enforcing HTTPS protocol and restricting subdomains to trusted hosts
- Introduce markChanged helper to update changed and deployFinished states together on mod list modifications
- Move mod file open dialog result IPC listener to page level to prevent duplicate listener registration
- Install mods into temporary sibling directories first and rename them into place after copy operations succeed
- Guard execFileAsync and staging progress flags with run identity checks to prevent staging race conditions
- Track deploy process identifier and send IPC signal to terminate process tree instead of global taskkill
- Stream auto-install downloads chunk-by-chunk to disk and wrap file operations in a unified try-catch-finally block
- Resolve foldersMap compile error by querying getModFolder helper with knownMods presence validation
…/O), and layout improvements, add warning count, improve deploy error specificity and flush final console logs

- Restrict console resizing to the vertical axis only (resize: vertical)
- Set console dimensions to range between a 25vh minimum and a 535px maximum height cap
- Implement incremental console log parser with a throttled 200ms update frequency to prevent UI lag and improve I/O
- Reset the deployment warnings state array when opening the modal to clear previous run leaks
- Render the progress bar percentage text in white during active deployment
- Count warnings in the sidebar with bold gray indices in style `[xx]`
- Added total warnings count to the sidebar header
- Preserve and append process launch failure errors to the deployment logs inside electron.cjs
- Refactor deploy exit error checking in electron.cjs to report neutral failure messages for non-spawn errors
- Flush the throttled console log rendering immediately on deployment finished to avoid missing trailing logs
…gress UI

refactor: optimize validation cache and resolve linter warnings

Improve Mod Manager responsiveness, reliability, and stability by implementing async file operations, safe rollback swaps, and optimizing validation caching.

## UI/UX and process stability (`modList/+page.svelte`, `electron.cjs`)
+ Add deleteInProgress and importInProgress loading states with modal progress indicators
~ Make mod import and delete operations run asynchronously
~ Bind dialogs to main window to ensure proper modal focus
~ Ignore staging and temp directories in electron-reloader to prevent page reloads
~ Fix HTML markup inside the delete modal by moving progress bar container out of paragraph tags

## Safe swap and rollback (`+page.svelte`, `modList/+page.svelte`)
+ Implement safeReplaceFolder helper to rename dest to backup and restore it if rename fails
~ Replace destinations using safeReplaceFolder in bulk import framework and RPKG paths
~ Apply safe swap rollback pattern to synchronous mod updates

## Caching and validation (`utils.ts`, `+page.svelte`)
+ Add clearValidationCacheForFolder to clear cache for both raw and resolved paths
~ Selectively invalidate validation cache per folder during imports and updates
~ Return safe default manifest values on read or parse failure to avoid crashes
- Remove debug cache hit console info message
…elte`)

style: add skipcq directive to suppress warning (`utils.ts`)

Add inline documentation comments and skipcq directives to improve code clarity and resolve static analysis warnings.

## Caching and validation (`utils.ts`)
+ Add JSDoc comments to `markModAsDeleting` and `unmarkModAsDeleting` status helpers
+ Add JSDoc comments to fallback manifest reader `getManifestFromModID`
+ Add JSDoc comments to validation cache invalidator `clearValidationCacheForFolder`
~ Add skipcq directive for window.alert warning to resolve DeepSource JS-0052 alert check

## Safe swap and rollback (`modList/+page.svelte`)
+ Add JSDoc comments to folder replacement swap helper `safeReplaceFolder`
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.

1 participant