A local-first personal finance app
🔧 Prevent sidebar from saving to metadata until resize is complete (#3393)
Michael Clark008a8a78b924
diff --git a/packages/desktop-client/src/components/sidebar/Sidebar.tsx b/packages/desktop-client/src/components/sidebar/Sidebar.tsxindex 7ea8c47f57..efdb8fb869 100644--- a/packages/desktop-client/src/components/sidebar/Sidebar.tsx+++ b/packages/desktop-client/src/components/sidebar/Sidebar.tsx@@ -50,15 +50,26 @@ export function Sidebar() {const [isFloating = false, setFloatingSidebarPref] =useGlobalPref('floatingSidebar');- const [_sidebarWidth, setSidebarWidth] = useLocalPref('sidebarWidth');+ const [sidebarWidthLocalPref, setSidebarWidthLocalPref] =+ useLocalPref('sidebarWidth');const DEFAULT_SIDEBAR_WIDTH = 240;const MAX_SIDEBAR_WIDTH = width / 3;const MIN_SIDEBAR_WIDTH = 200;- const sidebarWidth = Math.min(- MAX_SIDEBAR_WIDTH,- Math.max(MIN_SIDEBAR_WIDTH, _sidebarWidth || DEFAULT_SIDEBAR_WIDTH),++ const [sidebarWidth, setSidebarWidth] = useState(+ Math.min(+ MAX_SIDEBAR_WIDTH,+ Math.max(+ MIN_SIDEBAR_WIDTH,+ sidebarWidthLocalPref || DEFAULT_SIDEBAR_WIDTH,+ ),+ ),);+ const onResizeStop = () => {+ setSidebarWidthLocalPref(sidebarWidth);+ };+async function onReorder(id: string,dropPos: 'top' | 'bottom',@@ -95,6 +106,7 @@ export function Sidebar() {width: sidebarWidth,height: '100%',}}+ onResizeStop={onResizeStop}maxWidth={MAX_SIDEBAR_WIDTH}minWidth={MIN_SIDEBAR_WIDTH}enable={{diff --git a/upcoming-release-notes/3393.md b/upcoming-release-notes/3393.mdnew file mode 100644index 0000000000..b060f56b5d--- /dev/null+++ b/upcoming-release-notes/3393.md@@ -0,0 +1,6 @@+---+category: Maintenance+authors: [MikesGlitch]+---++Prevent sidebar from saving to metadata.json unnecessarily