Merge branch 'fix/mapPivot' into 'develop'
fix: 🐛 fix error on multiselect helper function, when no model was passed
See merge request ldc-web/projets/ldc!91
This commit is contained in:
commit
37fa9244df
2 changed files with 4 additions and 4 deletions
|
|
@ -137,7 +137,7 @@ export default function Form({
|
|||
}),
|
||||
).ucFirst().value()}
|
||||
placeholder={"ex: " + enumDocStatus.unpublished.label}
|
||||
selected={String(data.status)}
|
||||
selected={Number(data.status)}
|
||||
setData={setData}
|
||||
/>
|
||||
</FieldsetWrapper>
|
||||
|
|
|
|||
|
|
@ -13,16 +13,16 @@ export function mapPivotOptions<
|
|||
/** If we have a translatable field we pass the current locale */
|
||||
locale?: string | null
|
||||
) {
|
||||
const options = model.map((opt) => {
|
||||
const options = (model && model.length) ? model.map((opt) => {
|
||||
const raw = opt[valueKey as keyof typeof opt] as unknown as string;
|
||||
|
||||
return {
|
||||
value: opt.id.toString(),
|
||||
label: locale && typeof raw === "object"
|
||||
? raw[locale]
|
||||
: raw
|
||||
};
|
||||
});
|
||||
}) : [];
|
||||
|
||||
const defaultValue: string[] = data && valueKey
|
||||
? data.map((item) => {
|
||||
return item.id.toString();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue