File tree stuff (#3679)

* Fix and test file tree operations

* fmt

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* Make tsc happy

* I've been lied to

* Fix navigating to deleted file

* tsc

* Remove debugger statement

* Fix test

* All tests fixed

* Remove old config and remove slowmo

* fmt

* Remove unintentional changelog in readme (#3678)

* lint

* fmt

* Increase test timeout

* Fix the damn test

* fix web app

* fmt

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch>
This commit is contained in:
49fl
2024-08-28 06:38:14 -04:00
committed by GitHub
parent ed339a6b9a
commit 5e8227ead8
10 changed files with 335 additions and 64 deletions

View File

@ -90,12 +90,24 @@ export const fileLoader: LoaderFunction = async (
let code = ''
if (!urlObj.pathname.endsWith('/settings')) {
if (!currentFileName || !currentFilePath || !projectName) {
const fallbackFile = isDesktop()
? (await getProjectInfo(projectPath)).default_file
: ''
let fileExists = isDesktop()
if (currentFilePath && fileExists) {
try {
await window.electron.stat(currentFilePath)
} catch (e) {
if (e === 'ENOENT') {
fileExists = false
}
}
}
if (!fileExists || !currentFileName || !currentFilePath || !projectName) {
return redirect(
`${PATHS.FILE}/${encodeURIComponent(
isDesktop()
? (await getProjectInfo(projectPath)).default_file
: params.id + '/' + PROJECT_ENTRYPOINT
isDesktop() ? fallbackFile : params.id + '/' + PROJECT_ENTRYPOINT
)}`
)
}