fix code not executing tauri project load (#2165)
Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
@ -12,6 +12,7 @@ import { APP_NAME } from 'lib/constants'
|
||||
import { useCommandsContext } from 'hooks/useCommandsContext'
|
||||
import { CustomIcon } from './CustomIcon'
|
||||
import { useLspContext } from './LspProvider'
|
||||
import { engineCommandManager } from 'lib/singletons'
|
||||
|
||||
const ProjectSidebarMenu = ({
|
||||
project,
|
||||
@ -28,6 +29,8 @@ const ProjectSidebarMenu = ({
|
||||
<Link
|
||||
onClick={() => {
|
||||
onProjectClose(file || null, project?.path || null, false)
|
||||
// Clear the scene and end the session.
|
||||
engineCommandManager.endSession()
|
||||
}}
|
||||
to={paths.HOME}
|
||||
className="relative h-full grid place-content-center group p-1.5 before:block before:content-[''] before:absolute before:inset-0 before:bottom-2.5 before:z-[-1] before:bg-primary hover:before:brightness-110 before:rounded-b-sm"
|
||||
@ -39,6 +42,8 @@ const ProjectSidebarMenu = ({
|
||||
<Link
|
||||
onClick={() => {
|
||||
onProjectClose(file || null, project?.path || null, false)
|
||||
// Clear the scene and end the session.
|
||||
engineCommandManager.endSession()
|
||||
}}
|
||||
to={paths.HOME}
|
||||
className="!no-underline"
|
||||
@ -177,6 +182,8 @@ function ProjectMenuPopover({
|
||||
Element="button"
|
||||
onClick={() => {
|
||||
onProjectClose(file || null, project?.path || null, true)
|
||||
// Clear the scene and end the session.
|
||||
engineCommandManager.endSession()
|
||||
}}
|
||||
icon={{
|
||||
icon: 'arrowLeft',
|
||||
|
@ -259,7 +259,11 @@ export class KclManager {
|
||||
executeCode(force?: boolean) {
|
||||
// If we want to force it we don't want to defer it.
|
||||
if (!force) return this._defferer(codeManager.code)
|
||||
return this.executeAst()
|
||||
|
||||
const ast = this.safeParse(codeManager.code)
|
||||
if (!ast) return
|
||||
this.ast = { ...ast }
|
||||
return this.executeAst(ast)
|
||||
}
|
||||
format() {
|
||||
const originalCode = codeManager.code
|
||||
|
@ -101,6 +101,8 @@ export const fileLoader: LoaderFunction = async ({
|
||||
path: projectPath,
|
||||
})
|
||||
// Update both the state and the editor's code.
|
||||
// We explicitly do not write to the file here since we are loading from
|
||||
// the file system and not the editor.
|
||||
codeManager.updateCodeStateEditor(code)
|
||||
kclManager.executeCode(true)
|
||||
|
||||
|
Reference in New Issue
Block a user