From 5c3cd5d0dc620a64b13475c7daa5638ddcb061bb Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Sat, 16 Aug 2025 12:17:21 -0400 Subject: fix unique prof creation in conf --- py_modules/lsfg_vk/config_schema.py | 8 ++++++-- src/components/Content.tsx | 10 ++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/py_modules/lsfg_vk/config_schema.py b/py_modules/lsfg_vk/config_schema.py index 60e54e0..8027bc1 100644 --- a/py_modules/lsfg_vk/config_schema.py +++ b/py_modules/lsfg_vk/config_schema.py @@ -213,7 +213,11 @@ class ConfigurationManager: lines.append("") # Add game sections for each profile - for profile_name, config in profile_data["profiles"].items(): + # Sort profiles to ensure consistent order (default profile first) + sorted_profiles = sorted(profile_data["profiles"].items(), + key=lambda x: (x[0] != DEFAULT_PROFILE_NAME, x[0])) + + for profile_name, config in sorted_profiles: lines.append("[[game]]") if profile_name == DEFAULT_PROFILE_NAME: lines.append("# Plugin-managed game entry (default profile)") @@ -228,7 +232,7 @@ class ConfigurationManager: if field_name in GLOBAL_SECTION_FIELDS: continue - value = config[field_name] + value = config.get(field_name, field_def.default) # Add field description comment lines.append(f"# {field_def.description}") diff --git a/src/components/Content.tsx b/src/components/Content.tsx index c7c757b..d823257 100644 --- a/src/components/Content.tsx +++ b/src/components/Content.tsx @@ -50,11 +50,13 @@ export function Content() { // If we have a current profile, update that profile specifically if (currentProfile) { const newConfig = { ...config, [fieldName]: value }; - await updateProfileConfig(currentProfile, newConfig); - // Also update local config state - await updateField(fieldName, value); + const result = await updateProfileConfig(currentProfile, newConfig); + if (result.success) { + // Reload config to reflect the changes from the backend + await loadLsfgConfig(); + } } else { - // Fallback to the original method + // Fallback to the original method for backward compatibility await updateField(fieldName, value); } }; -- cgit v1.2.3