fix: we are so back
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user