From 50c3d263f7df3f47777889ddc1f1a77e1fdba083 Mon Sep 17 00:00:00 2001
From: xXJSONDeruloXx <danielhimebauch@gmail.com>
Date: Thu, 24 Jul 2025 21:33:21 -0400
Subject: add state persistence to collapsible workarounds section

---
 src/components/ConfigurationSection.tsx | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

(limited to 'src/components/ConfigurationSection.tsx')

diff --git a/src/components/ConfigurationSection.tsx b/src/components/ConfigurationSection.tsx
index a1aca09..57c75ad 100644
--- a/src/components/ConfigurationSection.tsx
+++ b/src/components/ConfigurationSection.tsx
@@ -1,5 +1,5 @@
 import { PanelSectionRow, ToggleField, SliderField, ButtonItem } from "@decky/ui";
-import { useState } from "react";
+import { useState, useEffect } from "react";
 import { RiArrowDownSFill, RiArrowUpSFill } from "react-icons/ri";
 import { ConfigurationData } from "../config/configSchema";
 import { FpsMultiplierControl } from "./FpsMultiplierControl";
@@ -14,11 +14,30 @@ interface ConfigurationSectionProps {
   onConfigChange: (fieldName: keyof ConfigurationData, value: boolean | number | string) => Promise<void>;
 }
 
+const WORKAROUNDS_COLLAPSED_KEY = 'lsfg-workarounds-collapsed';
+
 export function ConfigurationSection({
   config,
   onConfigChange
 }: ConfigurationSectionProps) {
-  const [workaroundsCollapsed, setWorkaroundsCollapsed] = useState(true);
+  // Initialize with localStorage value, fallback to true if not found
+  const [workaroundsCollapsed, setWorkaroundsCollapsed] = useState(() => {
+    try {
+      const saved = localStorage.getItem(WORKAROUNDS_COLLAPSED_KEY);
+      return saved !== null ? JSON.parse(saved) : true;
+    } catch {
+      return true;
+    }
+  });
+
+  // Persist workarounds collapse state to localStorage
+  useEffect(() => {
+    try {
+      localStorage.setItem(WORKAROUNDS_COLLAPSED_KEY, JSON.stringify(workaroundsCollapsed));
+    } catch (error) {
+      console.warn('Failed to save workarounds collapse state:', error);
+    }
+  }, [workaroundsCollapsed]);
 
   return (
     <>
-- 
cgit v1.2.3

