fix: skeleton logic for react? going to move it from a string to obj.string

This commit is contained in:
Kevin Nadro
2025-04-09 14:47:54 -06:00
parent 8490b3815d
commit 562f8337bd
4 changed files with 33 additions and 9 deletions

View File

@ -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
}