Skip to content

Commit

Permalink
read in existing child object
Browse files Browse the repository at this point in the history
  • Loading branch information
wbglaeser committed Jun 28, 2024
1 parent 71fdb7b commit 6cc5921
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/screens/profile-section/components/ProfileSectionClass.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useState} from "react";
import React, {useEffect, useState} from "react";
import HStack from "../../../components/HStack";
import VStack from "../../../components/VStack";
import {Button, Card, CardContent, Typography} from "@mui/material";
Expand All @@ -10,14 +10,23 @@ import ButtonBase from "@mui/material/ButtonBase";
import {useNavigate} from "react-router-dom";
import useUpdateProfileSectionStore from "../hooks/useUpdateProfileSectionStore";

const ProfileSectionClass = ({currentField, entityData}) => {
const ProfileSectionClass = ({value, currentField, entityData}) => {
const navigate = useNavigate();
const updateProfileSectionStore = useUpdateProfileSectionStore();
const [objectsMap, setObjectsMap] = useState({
index: 0,
objects: []
});

useEffect(() => {
if (value.length > 0) {
setObjectsMap({
index: value.length,
objects: value.map(item => item['@id'])
});
}
}, [value]);

const handleAddObjectLink = () => {
setObjectsMap({
index: objectsMap.index + 1,
Expand Down
2 changes: 2 additions & 0 deletions src/screens/profile-section/components/ProfileSectionField.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ const ProfileSectionField = ({
)
}

console.log('current value', value)

return (
<VStack gap={7}>
<VStack gap={2}>
Expand Down

0 comments on commit 6cc5921

Please sign in to comment.