|
|
|
@ -87,14 +87,12 @@ export default function Project(props: IProjectProps) {
|
|
|
|
|
|
|
|
|
|
|
|
const { data, error, isFetching } = useProject(uuid)
|
|
|
|
const { data, error, isFetching } = useProject(uuid)
|
|
|
|
|
|
|
|
|
|
|
|
const { nodesAsList, clientNodeItems } = useMemo(() => {
|
|
|
|
useEffect(() => {
|
|
|
|
if (!data) {
|
|
|
|
if (!data) {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const nodesAsList = Object.keys(projectData.canvas.nodes).map(k => {
|
|
|
|
const nodesAsList = Object.keys(data.canvas.nodes).map(k => data.canvas.nodes[k])
|
|
|
|
return projectData.canvas.nodes[k]
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const clientNodeItems = getClientNodesAndConnections(
|
|
|
|
const clientNodeItems = getClientNodesAndConnections(
|
|
|
|
nodesAsList,
|
|
|
|
nodesAsList,
|
|
|
|
@ -106,11 +104,11 @@ export default function Project(props: IProjectProps) {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
dispatch(updateProjectName(data.name));
|
|
|
|
dispatch(updateProjectName(data.name));
|
|
|
|
dispatch(nodes(clientNodeItems));
|
|
|
|
dispatch(nodes(clientNodeItems));
|
|
|
|
dispatch(connections(projectData.canvas.connections));
|
|
|
|
dispatch(connections(data.canvas.connections));
|
|
|
|
dispatch(position(projectData.canvas.position));
|
|
|
|
dispatch(position(data.canvas.position));
|
|
|
|
|
|
|
|
|
|
|
|
return { nodesAsList, clientNodeItems }
|
|
|
|
return { nodesAsList, clientNodeItems }
|
|
|
|
}, [dispatch])
|
|
|
|
}, [dispatch, data])
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
useEffect(() => {
|
|
|
|
if (uuid && !isFetching && data) {
|
|
|
|
if (uuid && !isFetching && data) {
|
|
|
|
|