🐛 fixing an open file race condition

This commit is contained in:
TC
2026-06-01 21:35:51 +10:00
parent c2e2c72574
commit c6a917feca
2 changed files with 15 additions and 5 deletions

View File

@@ -241,6 +241,14 @@ function createWindow(): BrowserWindow {
mainWindow.show() mainWindow.show()
}) })
mainWindow.on('enter-full-screen', () => {
mainWindow.setWindowButtonVisibility(false)
})
mainWindow.on('leave-full-screen', () => {
mainWindow.setWindowButtonVisibility(true)
})
mainWindow.webContents.setWindowOpenHandler((details) => { mainWindow.webContents.setWindowOpenHandler((details) => {
shell.openExternal(details.url) shell.openExternal(details.url)
return { action: 'deny' } return { action: 'deny' }

View File

@@ -39,8 +39,9 @@ export default function App(): JSX.Element {
const switchProject = async (newPath: string): Promise<void> => { const switchProject = async (newPath: string): Promise<void> => {
await window.api.writeConfig({ projectPath: newPath }) await window.api.writeConfig({ projectPath: newPath })
clearActiveFile() clearActiveFile()
loadSession() const files = await window.api.listFiles()
window.api.listFiles().then(setFileTree) setFileTree(files)
await loadSession()
} }
// Load file tree, restore prefs + session, and detect first run // Load file tree, restore prefs + session, and detect first run
@@ -189,10 +190,11 @@ export default function App(): JSX.Element {
<SettingsDialog <SettingsDialog
onClose={() => { setSettingsOpen(false); setIsFirstRun(false) }} onClose={() => { setSettingsOpen(false); setIsFirstRun(false) }}
isSetup={isFirstRun} isSetup={isFirstRun}
onProjectChanged={() => { onProjectChanged={async () => {
clearActiveFile() clearActiveFile()
loadSession() const files = await window.api.listFiles()
window.api.listFiles().then(setFileTree) setFileTree(files)
await loadSession()
}} }}
/> />
)} )}