fix: skeleton logic for react? going to move it from a string to obj.string
This commit is contained in:
@ -5,18 +5,26 @@ import { useEffect } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import {
|
||||
NO_PROJECT_DIRECTORY,
|
||||
SystemIOMachineEvents
|
||||
} from '@src/machines/systemIO/utils'
|
||||
export const useAuthState = () => useSelector(systemIOActor, (state) => state)
|
||||
export const useRequestedProjectName = () => useSelector(systemIOActor, (state) => state.context.requestedProjectName)
|
||||
export const useProjectDirectoryPath = () => useSelector(systemIOActor, (state) => state.context.projectDirectoryPath)
|
||||
|
||||
|
||||
export function SystemIOMachineLogicListener() {
|
||||
const state = useAuthState()
|
||||
const requestedProjectName = useRequestedProjectName()
|
||||
const projectDirectoryPath = useProjectDirectoryPath()
|
||||
const navigate = useNavigate()
|
||||
useEffect(() => {
|
||||
/* const requestedPath = `${PATHS.FILE}/${encodeURIComponent(
|
||||
* requestedProjectName
|
||||
// TODO: use a {requestedProjectName: string} to by pass this clear logic...
|
||||
if (!requestedProjectName) {return}
|
||||
let projectPathWithoutSpecificKCLFile =
|
||||
projectDirectoryPath + window.electron.path.sep + requestedProjectName
|
||||
const requestedPath = `${PATHS.FILE}/${encodeURIComponent(
|
||||
projectPathWithoutSpecificKCLFile
|
||||
)}`
|
||||
* navigate(requestedPath) */
|
||||
console.log(state)
|
||||
}, [state])
|
||||
navigate(requestedPath)
|
||||
systemIOActor.send({type:SystemIOMachineEvents.clearRequestedProjectName})
|
||||
}, [requestedProjectName])
|
||||
return null
|
||||
}
|
||||
|
Reference in New Issue
Block a user