fix: ensures getDataByPath works
This commit is contained in:
@@ -31,6 +31,7 @@ const Text: React.FC<TextFieldType> = (props) => {
|
||||
|
||||
return (
|
||||
<TextInput
|
||||
path={path}
|
||||
name={name}
|
||||
value={value as string || ''}
|
||||
label={label}
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
"node_modules",
|
||||
"node_modules/**/node_modules",
|
||||
"src/admin",
|
||||
"src/**/*.spec.ts"
|
||||
"src/**/*.spec.ts",
|
||||
"demo/**/*.tsx"
|
||||
],
|
||||
"watch": [
|
||||
"src/**/*.ts",
|
||||
|
||||
@@ -7,7 +7,7 @@ const getDataByPath = (fields: Fields, path: string): unknown => {
|
||||
const name = path.split('.').pop();
|
||||
|
||||
const data = Object.keys(fields).reduce((matchedData, key) => {
|
||||
if (key.indexOf(`${path}.`) === 0) {
|
||||
if (key.indexOf(`${path}.`) === 0 || key === path) {
|
||||
return {
|
||||
...matchedData,
|
||||
[key.replace(pathPrefixToRemove, '')]: fields[key],
|
||||
|
||||
Reference in New Issue
Block a user