From 1a01222cb3125de8c6603aa6d8de7f5de7565a0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mose=20M=C3=BCller?= Date: Wed, 27 Mar 2024 09:32:18 +0100 Subject: [PATCH] updates changeCallback and SerializedObject in GenericComponent.tsx --- frontend/src/components/GenericComponent.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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') {