diff --git a/frontend/src/components/GenericComponent.tsx b/frontend/src/components/GenericComponent.tsx index ccc9760..44c98d0 100644 --- a/frontend/src/components/GenericComponent.tsx +++ b/frontend/src/components/GenericComponent.tsx @@ -14,7 +14,7 @@ import { ColouredEnumComponent } from './ColouredEnumComponent'; import { LevelName } from './NotificationsComponent'; import { getIdFromFullAccessPath } from '../utils/stringUtils'; import { WebSettingsContext } from '../WebSettings'; -import { setAttribute } from '../socket'; +import { updateValue } from '../socket'; type AttributeType = | 'str' @@ -34,6 +34,8 @@ type AttributeType = type ValueType = boolean | string | number | Record; export type SerializedValue = { type: AttributeType; + full_access_path: string; + name?: string; value?: ValueType | ValueType[]; readonly: boolean; doc?: string | null; @@ -72,12 +74,10 @@ export const GenericComponent = React.memo( } function changeCallback( - value: unknown, - attributeName: string = name, - prefix: string = parentPath, + value: SerializedValue, callback: (ack: unknown) => void = undefined ) { - setAttribute(attributeName, prefix, value, callback); + updateValue(value, callback); } if (attribute.type === 'bool') {