diff --git a/frontend/src/components/ButtonComponent.tsx b/frontend/src/components/ButtonComponent.tsx index f3915b2..70be699 100644 --- a/frontend/src/components/ButtonComponent.tsx +++ b/frontend/src/components/ButtonComponent.tsx @@ -19,7 +19,8 @@ export const ButtonComponent = React.memo((props: ButtonComponentProps) => { const { name, parentPath, value, readOnly, docString, mapping, addNotification } = props; const buttonName = mapping ? (value ? mapping[0] : mapping[1]) : name; - const id = getIdFromFullAccessPath(parentPath.concat('.' + name)); + const fullAccessPath = [parentPath, name].filter((element) => element).join('.'); + const id = getIdFromFullAccessPath(fullAccessPath); const renderCount = useRef(0); diff --git a/frontend/src/components/ColouredEnumComponent.tsx b/frontend/src/components/ColouredEnumComponent.tsx index d2b8393..5863f7b 100644 --- a/frontend/src/components/ColouredEnumComponent.tsx +++ b/frontend/src/components/ColouredEnumComponent.tsx @@ -26,7 +26,8 @@ export const ColouredEnumComponent = React.memo((props: ColouredEnumComponentPro addNotification } = props; const renderCount = useRef(0); - const id = getIdFromFullAccessPath(parentPath.concat('.' + name)); + const fullAccessPath = [parentPath, name].filter((element) => element).join('.'); + const id = getIdFromFullAccessPath(fullAccessPath); useEffect(() => { renderCount.current++; diff --git a/frontend/src/components/DataServiceComponent.tsx b/frontend/src/components/DataServiceComponent.tsx index 00f2ca3..1971e0c 100644 --- a/frontend/src/components/DataServiceComponent.tsx +++ b/frontend/src/components/DataServiceComponent.tsx @@ -20,14 +20,14 @@ export const DataServiceComponent = React.memo( ({ name, props, - parentPath = 'DataService', + parentPath = '', isInstantUpdate, addNotification }: DataServiceProps) => { const [open, setOpen] = useState(true); let fullAccessPath = parentPath; if (name) { - fullAccessPath = parentPath.concat('.' + name); + fullAccessPath = [parentPath, name].filter((element) => element).join('.'); } const id = getIdFromFullAccessPath(fullAccessPath); diff --git a/frontend/src/components/EnumComponent.tsx b/frontend/src/components/EnumComponent.tsx index e53cd83..03f556c 100644 --- a/frontend/src/components/EnumComponent.tsx +++ b/frontend/src/components/EnumComponent.tsx @@ -1,6 +1,7 @@ import React, { useEffect, useRef } from 'react'; import { InputGroup, Form, Row, Col } from 'react-bootstrap'; import { setAttribute } from '../socket'; +import { getIdFromFullAccessPath } from '../utils/stringUtils'; import { DocStringComponent } from './DocStringComponent'; import { LevelName } from './NotificationsComponent'; @@ -24,6 +25,8 @@ export const EnumComponent = React.memo((props: EnumComponentProps) => { } = props; const renderCount = useRef(0); + const fullAccessPath = [parentPath, name].filter((element) => element).join('.'); + const id = getIdFromFullAccessPath(fullAccessPath); useEffect(() => { renderCount.current++; @@ -38,7 +41,7 @@ export const EnumComponent = React.memo((props: EnumComponentProps) => { }; return ( -