🐛 fixing an open file race condition
This commit is contained in:
@@ -241,6 +241,14 @@ function createWindow(): BrowserWindow {
|
||||
mainWindow.show()
|
||||
})
|
||||
|
||||
mainWindow.on('enter-full-screen', () => {
|
||||
mainWindow.setWindowButtonVisibility(false)
|
||||
})
|
||||
|
||||
mainWindow.on('leave-full-screen', () => {
|
||||
mainWindow.setWindowButtonVisibility(true)
|
||||
})
|
||||
|
||||
mainWindow.webContents.setWindowOpenHandler((details) => {
|
||||
shell.openExternal(details.url)
|
||||
return { action: 'deny' }
|
||||
|
||||
@@ -39,8 +39,9 @@ export default function App(): JSX.Element {
|
||||
const switchProject = async (newPath: string): Promise<void> => {
|
||||
await window.api.writeConfig({ projectPath: newPath })
|
||||
clearActiveFile()
|
||||
loadSession()
|
||||
window.api.listFiles().then(setFileTree)
|
||||
const files = await window.api.listFiles()
|
||||
setFileTree(files)
|
||||
await loadSession()
|
||||
}
|
||||
|
||||
// Load file tree, restore prefs + session, and detect first run
|
||||
@@ -189,10 +190,11 @@ export default function App(): JSX.Element {
|
||||
<SettingsDialog
|
||||
onClose={() => { setSettingsOpen(false); setIsFirstRun(false) }}
|
||||
isSetup={isFirstRun}
|
||||
onProjectChanged={() => {
|
||||
onProjectChanged={async () => {
|
||||
clearActiveFile()
|
||||
loadSession()
|
||||
window.api.listFiles().then(setFileTree)
|
||||
const files = await window.api.listFiles()
|
||||
setFileTree(files)
|
||||
await loadSession()
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user