Expand description
§DispatchFrontendCommand (Track)
§RESPONSIBILITIES
This module provides the primary Tauri command handler for requests originating from the Sky frontend. It serves as the general-purpose entry point for commands that are defined abstractly in the Common crate.
§Core Functions:
- Receive frontend commands via Tauri IPC
- Route commands to the effect creation system
- Execute effects through the ApplicationRunTime
- Return results or errors to the frontend
§ARCHITECTURAL ROLE
DispatchFrontendCommand acts as the frontend gateway in Track’s dispatch layer:
Sky (Frontend) ──► DispatchFrontendCommand ──► CreateEffectForRequest ──► ApplicationRunTime ──► Providers§KEY COMPONENTS
- Fn: Main dispatch function (public async fn Fn<R:Runtime>)
§ERROR HANDLING
- Effect creation failures are caught and logged
- Unknown commands are reported with context
- Errors are propagated to the frontend with descriptive messages
§LOGGING
- All incoming commands are logged at debug level
- Effect creation failures are logged at error level
- Log format: “[Track/FrontendCommand] Dispatching frontend command: {}”
§PERFORMANCE CONSIDERATIONS
- Direct effect execution without intermediate overhead
- Minimal locking to avoid blocking the UI thread
- Async operations to prevent blocking
§TODO
- Add request timeout handling
- Implement request cancellation support (VS Code compatibility)
- Add request metrics and telemetry
Functions§
- Dispatch
Frontend Command - The primary Tauri command handler for requests originating from the
Skyfrontend. This is the general-purpose entry point for commands that are defined abstractly in theCommoncrate.