Skip to content

Commit

Permalink
fix: revert fix on editorFeatures
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriocomo committed Nov 15, 2024
1 parent d0a842a commit b720cce
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/app/components/EditorFeatures.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,23 @@ import { get } from "lodash";
import { useState } from "react";
import { Button, Icon, Input, InputGroup } from "design-react-kit";

type Lang = 'it' | 'en' | 'fr'

interface Props {
lang: string;
}

export default function EditorFeatures({ lang }: Props): JSX.Element {
const propertyName: `description.${Lang}.features` = `description.${lang as Lang}.features`;

const { control, watch } = useFormContext<PublicCode>();
const { control } = useFormContext<PublicCode>();
const {
field: { onChange },
field: { onChange, value },
formState: { errors },
} = useController<PublicCode>({
control,
name: `description.${lang}.features`,
shouldUnregister: true,
});
const { t } = useTranslation();
//https://react-hook-form.com/advanced-usage#ControlledmixedwithUncontrolledComponents
const features = watch(propertyName) ?? [];
//const features: string[] = value ? (value as string[]) : [];

const features: string[] = value ? (value as string[]) : [];
const [currFeat, setCurrFeat] = useState<string>("");

const label = t(`publiccodeyml.description.features.label`);
Expand Down

0 comments on commit b720cce

Please sign in to comment.