fix: guard preview updates behind blocking validation

Pause preview updates when the workspace config is not saveable, surface that state in the Live Preview panel, and treat incomplete threshold color setups as real blocking errors so MangoHud preview never sees the bad intermediate state.
This commit is contained in:
2026-03-31 20:01:35 -04:00
parent 7de8224e67
commit 86c4a11321
11 changed files with 392 additions and 83 deletions
+9 -7
View File
@@ -1,5 +1,6 @@
use crate::ui::pages::{
apply_live_preview_now, refresh_current_page_later, sync_config_ui, PageBuildContext,
apply_live_preview_now, refresh_current_page_later, replace_workspace_config, sync_config_ui,
PageBuildContext,
};
use crate::ui::toast::show_toast;
use crate::ui::widgets::tool_page;
@@ -143,12 +144,13 @@ fn open_editor_window(ctx: &PageBuildContext) {
let end = buffer_apply.end_iter();
let text = buffer_apply.text(&start, &end, false).to_string();
if let Ok(mut state) = ctx_apply.state.lock() {
let parsed = Parser::parse_str(&text, state.config.path.clone());
state.config = parsed;
state.config.dirty = true;
state.dirty = true;
}
let current_path = ctx_apply
.state
.lock()
.ok()
.and_then(|state| state.config.path.clone());
let parsed = Parser::parse_str(&text, current_path);
replace_workspace_config(&ctx_apply, parsed, true);
update_footer(&footer_apply, &text);
sync_config_ui(&ctx_apply);