Added Concurrency for Faster Performance and Improved UX#4
Merged
Conversation
- Add rayon 1.X for parallel iteration - Parallelize get_all_tweak_statuses using par_iter - Parallelize detect_tweak_state with concurrent registry/service checks - Parallelize validate_all_snapshots for faster startup - Parallelize snapshot capture operations in capture.rs - Parallelize capture_current_state for rollback preparation This significantly reduces startup time and status refresh latency by running registry, service, and scheduler checks concurrently.
- Use thread::scope for parallel WMI queries - Each thread creates its own WMI connection (COM threading model) - CPU, GPU, monitors, memory, motherboard, disks, and network queries now run concurrently instead of sequentially This significantly reduces system info loading time on startup.
- Add loading state tracking in tweaksData store (systemInfoLoading, tweaksLoading, etc.) - Split initialization into initializeQuick + loadRemainingData for faster perceived load - Add loadingStateStore with canShowApp, isFullyLoaded, systemInfoLoading, tweaksLoading - Export new loading functions from tweaks barrel - Update +page.svelte to use progressive loading pattern - Add skeleton loading cards in CategoryTab for tweaks - Add skeleton loading states in OverviewTab for system info, hardware, and categories - Show app shell immediately after categories load, populate data progressively
- Create toast store with success/error/warning/info types - Create ToastContainer component with slide-in animation - Update applyTweak to show success/error toasts with tweak name - Update revertTweak to show success/error toasts with tweak name - Update applyPendingChanges to show summary toast - Add ToastContainer to layout for global notifications - Export toast store from stores barrel
- Revert visible: false to visible: true with backgroundColor #09090b for seamless dark theme loading - Remove unused show_main_window command from Rust backend and frontend - Fix skeleton loop lint warnings: replace Array(N) with explicit arrays in OverviewTab, Sidebar, CategoryTab - Fix par_iter().collect() anti-pattern in backup detection.rs - Improve initial loader with icon and smooth fade-out animation
- Fix blank window issue by repositioning loader CSS before SvelteKit injected styles - Moved loader <style> block before %sveltekit.head% in app.html - Prevents CSS blocking, ensuring spinner shows immediately on launch - Updated page title to 'MagicX Toolbox' - Add window visibility watchdog to prevent stuck hidden state - Created window_watchdog.rs with 10-second timeout failsafe - Auto-shows window if frontend fails to mount or signal readiness - Prevents app from running hidden in background on mount failures - Enhance show_main_window command with better error handling - Added visibility state checking before showing - Comprehensive logging to track normal vs fallback code paths - Prevents redundant show operations This fixes the issue where users would see a white screen for several seconds before the loading skeleton appeared, and ensures the window always becomes visible even if the frontend encounters errors.
Refactored getAllTweaksWithStatus to use a single batch IPC call for fetching all tweak statuses, reducing the number of IPC calls from N+1 to 2. This improves performance and efficiency when retrieving tweaks with their statuses.
Refactors data loading in +layout.svelte to start category loading immediately and overlap it with UI initialization, improving perceived performance. Updates +page.svelte to avoid duplicate network requests by checking if categories are already loaded, only loading remaining data if necessary.
Bump several dev dependencies including @types/node (to 24.10.4) and cpy-cli (to 6.0.0) in package.json. This also updates related transitive dependencies in bun.lock for improved compatibility and bug fixes.
…ropping failures - Add error field to TweakStatus struct (Rust + TypeScript) - Change filter_map to map in get_all_tweak_statuses to always return tweaks - Frontend now shows 'unknown state' badge for tweaks with detection errors - Users can still interact with errored tweaks (apply/revert) Resolves silent error suppression issue where tweaks failing state detection were dropped from results, leaving users confused about missing tweaks.
- Replace std::thread::sleep with tokio::time::sleep().await - Remove redundant nested spawn (function already called from spawned context) - Add tokio dependency with minimal 'time' feature only - Improve documentation with usage note This eliminates unnecessary thread blocking in the async runtime.
- Track timeout IDs in Map<string, ReturnType<typeof setTimeout>> - Clear timeout in dismiss() to prevent orphaned timers - Clear all timeouts in clear() for complete cleanup Previously, manually dismissing toasts left setTimeout callbacks running.
- Cache in-flight promises for quickInit() and loadRemainingData() - Return existing promise if already loading instead of triggering duplicate backend calls - Cleaner than boolean flag approach (automatic cleanup on resolution) Fixes concurrent requests from +layout.svelte and +page.svelte mounting simultaneously.
- Replace silent .ok() chains with match statements that log errors - Use log::debug! (visible in debug builds, silent in release) - Improves observability for hardware info query failures WMI failures are non-critical (UI shows 'Unknown' placeholders), so debug level is appropriate.
Minor formatting consistency improvements.
…zation BREAKING CHANGE: initializeData() is removed from public API - Remove initializeData() which bypassed promise caching - Update +page.svelte fallback to use initializeQuick() + loadRemainingData() - These functions have proper promise caching to prevent duplicate requests - Update all barrel exports to remove initializeData
- Remove slide-in-from-right-5 class which was never defined - Animation already works via custom .animate-in CSS class
Critical fix for revert_tweak command: - Add SYSTEM elevation support for scheduler task restoration Previously restore used admin-level schtasks which fails on protected Windows Update tasks with 'Access Denied' - Add SYSTEM elevation support for service restoration Services like WaaSMedicSvc require SYSTEM to modify - Return RestoreResult with detailed failure information Instead of silently continuing, collect all failures - Only delete snapshot on FULL success Previously snapshot was deleted even on partial failure, leaving system in inconsistent state with no way to retry - Preserve snapshot on partial restore for user retry This ensures users can retry failed reverts and the system state remains consistent even when some operations fail.
Updated the comment to better explain discarding the result to match the Promise<void> signature in the initializeQuick function.
…king - Simplify RestoreResult struct (remove unused count fields) - Fix batch operations to properly track partial successes - Count partial failures (success=false) separately from errors - Propagate inner failure details from TweakResult.failures - Remove unused RestoreResult export from module
- Extract and display detailed failure messages from TweakResult.failures - Don't update is_applied on partial revert failure (snapshot still exists) - Use warning toast instead of error for partial success - Allow user to retry revert when some operations failed
Refactored +layout.svelte to await initializeQuick directly, guaranteeing categories are loaded before +page.svelte's onMount runs. Updated +page.svelte to defensively check for categories and only load them if necessary, improving reliability and preventing race conditions.
- Change categoriesStore.load() to re-throw errors instead of returning [] - Change tweaksStore.load() to re-throw errors instead of returning [] - Add comments explaining why systemStore.load() still returns null on error - Remove defensive empty check in +page.svelte (no longer needed) - Simplify +layout.svelte to use static import for initializeQuick Categories are compiled at build time and must always load successfully. If loading fails, it indicates a critical IPC/runtime error that should surface to the error UI rather than being silently swallowed.
- Remove unused registry.rs module (file needs manual deletion) - Remove unused store methods from tweaksData, tweaksLoading, tweaksPending, tweaksActions - Remove unused API functions: getTweakStatuses, getTweaksForCurrentVersion, checkForUpdate - Remove console.log statements from systemElevation store - Update copilot-instructions.md to match actual store API
Expanded the eslint disable comment to explain why a plain Map is used for timeout IDs and why Svelte reactivity is not required in this context.
Expanded comments in detection.rs to clarify why scheduler changes are processed sequentially. The update explains the COM threading model and the need for per-thread COM initialization, documenting the rationale for avoiding parallelization in the current implementation.
Refactored get_hardware_info() to use 3 threads with WMI connection reuse instead of 7 separate threads each with its own connection: - Thread 1: Fast cimv2 queries (CPU, Memory, Motherboard, Network) - Thread 2: Slow cimv2 queries (GPU, Monitors) - WinAPI/registry heavy - Thread 3: Storage namespace (Disks) This reduces COM initialization overhead while maintaining good parallelism. Added timing log for performance monitoring.
- Add NaN check in TweakCard handleOptionChange to prevent invalid option index - Fix Sidebar effect race condition with initialization guard - Add schema validation for imported settings in SettingsModal - Show toast message when app exit fails after update install - Fix non-null assertion in colorScheme store with proper type narrowing
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.