Skip to content

Commit 1e28651

Browse files
fix-636: default select options
1 parent cf2d400 commit 1e28651

3 files changed

Lines changed: 16 additions & 11 deletions

File tree

admin/src/components/TextArrayInput/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { TextInput } from '@strapi/design-system';
22
import { isArray } from 'lodash';
3-
import React, { useState } from 'react';
3+
import React, { useEffect, useState } from 'react';
44

55
import { Effect } from '../../types';
66

@@ -15,8 +15,9 @@ interface IProps {
1515

1616
const TextArrayInput: React.FC<IProps> = ({ onChange, initialValue, ...props }) => {
1717
const [value, setValue] = useState(
18-
isArray(initialValue) ? initialValue.reduce((acc, cur) => `${acc}${cur}; `, '') : ''
18+
isArray(initialValue) ? initialValue.join(';') : ''
1919
);
20+
2021
const handleOnChange = (event: { target: { value?: string } }) => {
2122
const newValue: string = event?.target.value ?? '';
2223
const valuesArray = newValue

admin/src/pages/SettingsPage/components/CustomFieldsPanel/CustomFieldForm/index.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,18 @@ const CustomFieldForm: React.FC<ICustomFieldFormProps> = ({
5959

6060
const { formatMessage } = useIntl();
6161

62-
const [formValue, setFormValue] = useState<NavigationItemCustomField>({
63-
name: '',
64-
label: '',
65-
type: 'string',
66-
required: false,
67-
multi: false,
68-
enabled: true,
69-
});
62+
const [formValue, setFormValue] = useState<NavigationItemCustomField>(
63+
customField ? {
64+
...customField,
65+
} : {
66+
name: '',
67+
label: '',
68+
type: 'string',
69+
required: false,
70+
multi: false,
71+
enabled: true,
72+
},
73+
);
7074
const [formError, setFormError] = useState<FormItemErrorSchema<NavigationItemCustomField>>();
7175

7276
const { type } = formValue;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "strapi-plugin-navigation",
3-
"version": "3.3.1",
3+
"version": "3.3.2",
44
"description": "Strapi - Navigation plugin",
55
"strapi": {
66
"name": "navigation",

0 commit comments

Comments
 (0)