🐛 fixing an open file race condition
This commit is contained in:
@@ -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' }
|
||||||
|
|||||||
@@ -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()
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user