diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-03-06 13:43:21 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-06-18 22:56:01 -0300 |
commit | 23ec39493825d027506ba1a2124c8a8bc51a9cbe (patch) | |
tree | 95bfed2d760efbf93734eb9704e311c27a01d06b /src/data/composite | |
parent | 94bdc5e8356834e2cc22695e196ba4f50014d05f (diff) |
data: inheritFromContributionPresets: logic cleanup
Diffstat (limited to 'src/data/composite')
-rw-r--r-- | src/data/composite/things/contribution/inheritFromContributionPresets.js | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/src/data/composite/things/contribution/inheritFromContributionPresets.js b/src/data/composite/things/contribution/inheritFromContributionPresets.js index 72642957..82425b9c 100644 --- a/src/data/composite/things/contribution/inheritFromContributionPresets.js +++ b/src/data/composite/things/contribution/inheritFromContributionPresets.js @@ -34,7 +34,7 @@ export default templateCompositeFrom({ compute: (continuation, { ['#values']: values, }) => continuation({ - ['#presetIndex']: + ['#index']: values.findIndex(value => value !== undefined && value !== null), @@ -42,35 +42,20 @@ export default templateCompositeFrom({ }, raiseOutputWithoutDependency({ - dependency: '#presetIndex', + dependency: '#index', mode: input.value('index'), }), { - dependencies: ['#presets', '#presetIndex'], + dependencies: ['#values', '#index'], compute: (continuation, { - ['#presets']: presets, - ['#presetIndex']: presetIndex, + ['#values']: values, + ['#index']: index, }) => continuation({ - ['#preset']: - presets[presetIndex], + ['#value']: + values[index], }), }, - - withPropertyFromObject({ - object: '#preset', - property: input('property'), - }), - - // Can't use exposeDependency here since it doesn't compose, and so looks - // unfit to serve as the composition's base - even though we'll have raised - // out of this composition in the relevant cases already! - { - dependencies: ['#value'], - compute: (continuation, { - ['#value']: value, - }) => continuation.exit(value), - }, ], }); |