diff options
| author | 2026-01-18 12:58:22 +0800 | |
|---|---|---|
| committer | 2026-01-18 12:58:22 +0800 | |
| commit | 5e9850881d35d3af9ae8a2f99402e02300f77835 (patch) | |
| tree | 630f071c903e5ff7b793e9f8fb96b35ebf8eda06 /ui/src/stores | |
| parent | ee6c73333ae585c601de6c0fcd216fdd7d2e7bce (diff) | |
| download | DropOut-5e9850881d35d3af9ae8a2f99402e02300f77835.tar.gz DropOut-5e9850881d35d3af9ae8a2f99402e02300f77835.zip | |
fix: complete Instance/Profile System isolation and state management
## Overview
Fixed critical multi-instance isolation bugs where versions, mod loaders, and
instance state were not properly isolated between instances. These changes ensure
full data isolation and consistent instance metadata.
## Bug Fixes - P0 (Critical Isolation Issues)
### 1. Backend: get_versions() command isolation
- Problem: Used global app_data_dir instead of instance-specific game_dir
- Fix: Added instance_id parameter, now queries instance.game_dir
- Impact: Versions are now properly isolated per instance
### 2. Frontend: delete_version missing instanceId
- Problem: Frontend passed only versionId, not instanceId
- Fix: Updated VersionsView.svelte to pass instanceId parameter
- Impact: Version deletion now targets correct instance
### 3. Frontend: get_version_metadata missing instanceId
- Problem: Metadata queries didn't specify which instance to check
- Fix: Updated VersionsView.svelte to pass instanceId parameter
- Impact: Version info displayed per-instance correctly
### 4. Frontend: Instance switching doesn't refresh versions
- Problem: Switching instances didn't reload version list
- Fix: Added $effect hook in GameState to watch activeInstanceId changes
- Impact: Version list auto-refreshes on instance switch
## Bug Fixes - P1 (State Synchronization)
### 5. Backend: install_fabric doesn't update Instance.mod_loader
- Problem: Instance.mod_loader field wasn't updated after installation
- Fix: Added instance_state.update_instance() call
- Impact: Instance metadata stays in sync
### 6. Backend: install_forge doesn't update Instance.mod_loader
- Problem: Instance.mod_loader field wasn't updated after installation
- Fix: Added instance_state.update_instance() call
- Impact: Instance metadata stays in sync
### 7. Backend: delete_version doesn't clean up Instance state
- Problem: Deleting version didn't clear Instance.version_id or .mod_loader
- Fix: Added cleanup logic to clear stale references
- Impact: Instance state remains valid after deletion
## Testing
- Added comprehensive integration tests in instance_isolation_tests.rs
- Tests document 10 key scenarios for multi-instance isolation
- All code compiles cleanly with no errors
Diffstat (limited to 'ui/src/stores')
| -rw-r--r-- | ui/src/stores/game.svelte.ts | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/ui/src/stores/game.svelte.ts b/ui/src/stores/game.svelte.ts index 1e4119f..15dcf22 100644 --- a/ui/src/stores/game.svelte.ts +++ b/ui/src/stores/game.svelte.ts @@ -8,13 +8,31 @@ export class GameState { versions = $state<Version[]>([]); selectedVersion = $state(""); + constructor() { + // Refresh versions when active instance changes + $effect(() => { + if (instancesState.activeInstanceId) { + this.loadVersions(); + } else { + this.versions = []; + } + }); + } + get latestRelease() { return this.versions.find((v) => v.type === "release"); } async loadVersions() { + if (!instancesState.activeInstanceId) { + this.versions = []; + return; + } + try { - this.versions = await invoke<Version[]>("get_versions"); + this.versions = await invoke<Version[]>("get_versions", { + instanceId: instancesState.activeInstanceId, + }); // Don't auto-select version here - let BottomBar handle version selection // based on installed versions only } catch (e) { |