diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 9f38e65..9fdef43 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -14,7 +14,9 @@ { "title": "OpenPylon", "width": 1200, - "height": 800 + "height": 800, + "minWidth": 800, + "minHeight": 600 } ], "security": { diff --git a/src/App.tsx b/src/App.tsx index 10b129e..372008e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,5 +1,7 @@ import { useState, useEffect, useCallback } from "react"; +import { getCurrentWindow } from "@tauri-apps/api/window"; import { useAppStore } from "@/stores/app-store"; +import { useBoardStore } from "@/stores/board-store"; import { AppShell } from "@/components/layout/AppShell"; import { BoardList } from "@/components/boards/BoardList"; import { BoardView } from "@/components/board/BoardView"; @@ -18,6 +20,16 @@ export default function App() { init(); }, [init]); + // Flush pending board saves before the app window closes + useEffect(() => { + const unlisten = getCurrentWindow().onCloseRequested(async () => { + useBoardStore.getState().closeBoard(); + }); + return () => { + unlisten.then((fn) => fn()); + }; + }, []); + // Listen for custom event to open settings from TopBar or command palette useEffect(() => { function handleOpenSettings() {