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()
}
// 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(() => {
window.api.listFiles().then(setFileTree)
async function init(): Promise<void> {
initPrefs()
loadSession()
window.api.readConfig().then((cfg) => {
const files = await window.api.listFiles()
setFileTree(files)
await loadSession()
const cfg = await window.api.readConfig()
if (!cfg.apiKey || !cfg.projectPath) {
setIsFirstRun(true)
setSettingsOpen(true)
}
})
}
init()
}, [])
// Handle menu actions sent from the main process