Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
riceyeh committed Nov 22, 2020
1 parent 53edf34 commit 4b707dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/shared/Initializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ export default {
const initial = this.state.get('current', 'props');
const struct = utils.pathToStruct(path);
// try to get props from separated objects
const $try = prop => initial[prop] && initial[prop][struct];

const $try = prop => {
const t = _.get(initial[prop], struct);
if ((prop === 'input' || prop === 'output') && typeof t !== 'function') return undefined
return t;
}
const props = {
$value: _.get(initial['values'], path),
$label: $try('labels'),
Expand Down
4 changes: 2 additions & 2 deletions tests/fixes.values.js
Original file line number Diff line number Diff line change
Expand Up @@ -513,11 +513,11 @@ describe('falsy fallback for array items', () => {
});

describe('output goes wrong', () => {
it.only('', () => {
it('', () => {
const fields = [
'customer',
'customer.name',
'customerid'
'customer.id'
];
const labels = {
'customer': 'Customer',
Expand Down

0 comments on commit 4b707dd

Please sign in to comment.