From bc1ca174b0bd59a52b807089afa47401930c2585 Mon Sep 17 00:00:00 2001 From: cha0s Date: Sun, 21 Jun 2020 22:43:52 -0500 Subject: [PATCH] chore: tidy --- src/common/resources/entity/trait-pane.jsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/common/resources/entity/trait-pane.jsx b/src/common/resources/entity/trait-pane.jsx index 3814fef..3a5021d 100644 --- a/src/common/resources/entity/trait-pane.jsx +++ b/src/common/resources/entity/trait-pane.jsx @@ -21,16 +21,15 @@ const ensureTraitComponents = () => { const makePane = (context, dispatch, target, type) => (trait) => { ensureTraitComponents(); - const {params: paramsRaw, state: stateRaw} = trait; + const {params, state} = trait; const {[type]: TraitComponent} = TraitComponents; const Trait = lookupTrait(type); - const params = Trait ? {...Trait.defaultParams(), ...paramsRaw} : paramsRaw; - const state = Trait ? {...Trait.defaultState(), ...stateRaw} : stateRaw; + if (!Trait) { + return null; + } if (TraitComponent) { return ; } - const paramsDescription = Trait?.describeParams() || {}; - const stateDescription = Trait?.describeState() || {}; const renderComponents = (traitHalf, description, values) => ( // eslint-disable-next-line no-shadow Object.values(mapObject(description, (description, key) => { @@ -69,8 +68,8 @@ const makePane = (context, dispatch, target, type) => (trait) => { ); return (
- {renderComponents('params', paramsDescription, params)} - {renderComponents('state', stateDescription, state)} + {renderComponents('params', Trait.describeParams(), params)} + {renderComponents('state', Trait.describeState(), state)}
); };