reset form instead of adding to it (#30650)

fixes: #30550

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
Erik Jan de Wit 2024-07-01 10:49:04 +02:00 committed by GitHub
parent cb048c9700
commit 213b4ca6d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -15,7 +15,7 @@ import {
AttributesForm,
} from "../components/key-value-form/AttributeForm";
import { arrayToKeyValue } from "../components/key-value-form/key-value-convert";
import { convertFormValuesToObject, convertToFormValues } from "../util";
import { convertFormValuesToObject } from "../util";
import { useFetch } from "../utils/useFetch";
import { getLastId } from "./groupIdUtils";
@ -35,7 +35,9 @@ export const GroupAttributes = () => {
useFetch(
() => adminClient.groups.findOne({ id }),
(group) => {
convertToFormValues(group!, form.setValue);
form.reset({
attributes: arrayToKeyValue(group?.attributes!),
});
setCurrentGroup(group);
},
[id],