Make it so we don't have to give permission multiple times on launch.

This commit is contained in:
TC
2026-06-05 11:47:12 +10:00
parent 1fe16b9a93
commit b90ddee096

View File

@@ -44,17 +44,21 @@ export default function App(): JSX.Element {
await loadSession() await loadSession()
} }
// Load file tree, restore prefs + session, and detect first run // Load file tree, restore prefs + session, and detect first run.
// Draft-directory calls are sequenced so macOS only prompts for folder access once.
useEffect(() => { useEffect(() => {
window.api.listFiles().then(setFileTree) async function init(): Promise<void> {
initPrefs() initPrefs()
loadSession() const files = await window.api.listFiles()
window.api.readConfig().then((cfg) => { setFileTree(files)
await loadSession()
const cfg = await window.api.readConfig()
if (!cfg.apiKey || !cfg.projectPath) { if (!cfg.apiKey || !cfg.projectPath) {
setIsFirstRun(true) setIsFirstRun(true)
setSettingsOpen(true) setSettingsOpen(true)
} }
}) }
init()
}, []) }, [])
// Handle menu actions sent from the main process // Handle menu actions sent from the main process