From d307ff6927aa015e1b4f5402340b2f2abaa5c949 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 13:04:01 +0100 Subject: [PATCH] Update status of the parent component --- app/ui/components/form/affinitySlider.tsx | 7 ++----- app/ui/components/group-form-dialog.tsx | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/ui/components/form/affinitySlider.tsx b/app/ui/components/form/affinitySlider.tsx index da82ff9..b434535 100644 --- a/app/ui/components/form/affinitySlider.tsx +++ b/app/ui/components/form/affinitySlider.tsx @@ -1,9 +1,6 @@ import { Slider } from 'primereact/slider'; -import React, { useEffect, useState } from 'react'; -export default function AffinitySlider({ initialValue, onChange }: { initialValue: number, onChange?: (value: number) => void }) { - const [value, setValue] = useState(initialValue); - useEffect(() => {setValue(initialValue)}, [initialValue]); +export default function AffinitySlider({value , onChange }: { value: number, onChange: (value: number) => void }) { const label = (value: number) => { if (value < 0.2) { @@ -25,7 +22,7 @@ export default function AffinitySlider({ initialValue, onChange }: { initialValu return ( <> - setValue(e.value)} className='w-80 bg-gray-400' /> + onChange(e.value)} className='w-80 bg-gray-400' /> { label(value) } diff --git a/app/ui/components/group-form-dialog.tsx b/app/ui/components/group-form-dialog.tsx index 2a78b67..226d40b 100644 --- a/app/ui/components/group-form-dialog.tsx +++ b/app/ui/components/group-form-dialog.tsx @@ -113,7 +113,7 @@ export default function GroupFormDialog({ groups, onCreate, onHide, group, visib groups.map((group) =>
{group.name} - + setAffinities({...affinities, [group.id || "default"]:value})} />
) }