Compare commits

...

2 commits

Author SHA1 Message Date
morpheus65535 369ca4c736
Merge 779fd8070e into cc7a8000e7 2024-09-18 22:58:18 +00:00
Anderson Shindy Oki 779fd8070e
Fixed edit profile duplicated items id by sanitizing them upon saving 2024-09-18 18:58:15 -04:00

View file

@ -79,10 +79,10 @@ const Table: FunctionComponent = () => {
}) => {
return (
<Group gap="xs" wrap="nowrap">
{items.map((v) => {
{items.map((v, i) => {
const isCutoff = v.id === cutoff || cutoff === anyCutoff;
return (
<ItemBadge key={v.id} cutoff={isCutoff} item={v}></ItemBadge>
<ItemBadge key={i} cutoff={isCutoff} item={v}></ItemBadge>
);
})}
</Group>
@ -148,9 +148,19 @@ const Table: FunctionComponent = () => {
icon={faWrench}
c="gray"
onClick={() => {
// We once had an issue on the past where there were duplicated
// item ids that needs to become unique upon editing.
const sanitizedProfile = {
...cloneDeep(profile),
items: profile.items.map((value, index) => {
return { ...value, id: index + 1 };
}),
tag: profile.tag || undefined,
};
modals.openContextModal(ProfileEditModal, {
languages,
profile: cloneDeep(profile),
profile: sanitizedProfile,
onComplete: updateProfile,
});
}}