From d98308b384bacaf870b56194edc9327b74a32cfa Mon Sep 17 00:00:00 2001 From: Ana Garcia Date: Fri, 2 Aug 2024 13:28:11 +0200 Subject: [PATCH] Do not use useMemo as is not needed --- src/webapp/components/form/FieldWidget.tsx | 34 +++++++--------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/src/webapp/components/form/FieldWidget.tsx b/src/webapp/components/form/FieldWidget.tsx index a2060123..2caf1113 100644 --- a/src/webapp/components/form/FieldWidget.tsx +++ b/src/webapp/components/form/FieldWidget.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useMemo } from "react"; +import React, { useCallback } from "react"; import { TextInput } from "../text-input/TextInput"; import { UserSelector } from "../user-selector/UserSelector"; @@ -26,28 +26,16 @@ export const FieldWidget: React.FC = React.memo((props): JSX.E [field, onChange] ); - const commonProps = useMemo( - () => ({ - id: field.id, - label: field.label, - onChange: handleChange, - helperText: field.helperText, - errorText: field.errors ? field.errors.join("\n") : "", - error: field.errors && field.errors.length > 0, - required: field.required && field.showIsRequired, - disabled: disabled, - }), - [ - disabled, - field.errors, - field.helperText, - field.id, - field.label, - field.required, - field.showIsRequired, - handleChange, - ] - ); + const commonProps = { + id: field.id, + label: field.label, + onChange: handleChange, + helperText: field.helperText, + errorText: field.errors ? field.errors.join("\n") : "", + error: field.errors && field.errors.length > 0, + required: field.required && field.showIsRequired, + disabled: disabled, + }; switch (field.type) { case "select": {