feat: implement migration progress tracking for cslol-manager mods#15
Merged
feat: implement migration progress tracking for cslol-manager mods#15
Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements progress tracking for the cslol-manager migration feature, allowing users to see real-time updates during both the packaging and installation phases of mod migration. The implementation adds a new MigrationProgress type that tracks the current phase (packaging or installing), progress counters, and the current file being processed.
Changes:
- Added progress tracking types and event emission for migration operations
- Created a new
useMigrationProgresshook that listens to both migration and install progress events - Converted migration commands to async to support non-blocking operations with progress updates
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/modules/migration/components/MigrationWizardDialog.tsx | Replaced BulkInstallProgress with new MigrationImportProgress component that shows phase-specific progress |
| src/modules/migration/api/useMigrationWizard.ts | Updated to use useMigrationProgress instead of useInstallProgress |
| src/modules/migration/api/useMigrationProgress.ts | New hook that listens to both migration-progress and install-progress events, transforming them into a unified progress state |
| src/modules/migration/api/index.ts | Exported the new useMigrationProgress hook |
| src/lib/tauri.ts | Added MigrationProgress and MigrationPhase TypeScript type definitions |
| src-tauri/src/mods/mod.rs | Added Rust types for MigrationProgress and MigrationPhase |
| src-tauri/src/mods/migration.rs | Added progress event emission during packaging phase, passing AppHandle to enable event emission |
| src-tauri/src/commands/migration.rs | Converted scan_cslol_mods and import_cslol_mods commands to async, using spawn_blocking for file I/O operations |
Comments suppressed due to low confidence (1)
src-tauri/src/mods/migration.rs:110
- Progress is emitted before checking if the folder exists. If a folder doesn't exist (line 108-110), the progress will still show it as being processed, which may be misleading to users. While this maintains the counter accuracy (showing X out of total selected), it could confuse users who see a folder name in the progress that wasn't actually packaged. Consider moving the progress emission after the folder existence check, or updating the current file name only for folders that are actually processed.
for (i, folder) in folders.iter().enumerate() {
let _ = app_handle.emit(
"migration-progress",
MigrationProgress {
phase: MigrationPhase::Packaging,
current: i + 1,
total,
current_file: folder.clone(),
},
);
let mod_dir = installed_dir.join(folder);
if !mod_dir.is_dir() {
tracing::warn!("Skipping missing folder: {}", folder);
continue;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.