fix: we are so back

This commit is contained in:
Kevin Nadro
2025-04-14 11:56:28 -06:00
parent b3e1326921
commit ba2570d2cd
8 changed files with 30 additions and 40 deletions

View File

@ -3,25 +3,26 @@ import { systemIOActor } from '@src/machines/appMachine'
import { useSelector } from '@xstate/react'
import { useEffect } from 'react'
import { useNavigate } from 'react-router-dom'
import {
NO_PROJECT_DIRECTORY,
SystemIOMachineEvents
} from '@src/machines/systemIO/utils'
export const useRequestedProjectName = () => useSelector(systemIOActor, (state) => state.context.requestedProjectName)
export const useProjectDirectoryPath = () => useSelector(systemIOActor, (state) => state.context.projectDirectoryPath)
export const useRequestedProjectName = () =>
useSelector(systemIOActor, (state) => state.context.requestedProjectName)
export const useProjectDirectoryPath = () =>
useSelector(systemIOActor, (state) => state.context.projectDirectoryPath)
export function SystemIOMachineLogicListener() {
const requestedProjectName = useRequestedProjectName()
const projectDirectoryPath = useProjectDirectoryPath()
const navigate = useNavigate()
useEffect(() => {
if (!requestedProjectName.name) {return}
if (!requestedProjectName.name) {
return
}
let projectPathWithoutSpecificKCLFile =
projectDirectoryPath + window.electron.path.sep + requestedProjectName.name
projectDirectoryPath +
window.electron.path.sep +
requestedProjectName.name
const requestedPath = `${PATHS.FILE}/${encodeURIComponent(
projectPathWithoutSpecificKCLFile
)}`
projectPathWithoutSpecificKCLFile
)}`
navigate(requestedPath)
}, [requestedProjectName])
return null